全站内容
Calf
这里收录 Calf 在 GoCalf 上的文章、笔记与其他内容。
1705. Maximum Number of Eaten Apples
#Problem There is a special kind of apple tree that grows apples every day for n days. On the iᵗʰ day, the tree grows apples[i] apples that will rot after days[i] days, that is on day i + days[i] the apples will be rotten and cannot be …
1706. Where Will the Ball Fall
#Problem You have a 2-D grid of size m x n representing a box, and you have n balls. The box is open on the top and bottom sides. Each cell in the box has a diagonal board spanning two corners of the cell that can redirect a ball to the …
171. Excel Sheet Column Number
#Problem Given a string columnTitle that represents the column title as appears in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 … Z -> 26 AA -> 27 AB -> 28 … …
1718. Construct the Lexicographically Largest Valid Sequence
#Problem Given an integer n, find a sequence that satisfies all of the following: The integer 1 occurs once in the sequence. Each integer between 2 and n occurs twice in the sequence. For every integer i between 2 and n, the distance …
1719. Number Of Ways To Reconstruct A Tree
#Problem You are given an array pairs, where pairs[i] = [xᵢ, yᵢ], and: There are no duplicates. xᵢ < yᵢ Let ways be the number of rooted trees that satisfy the following conditions: The tree consists of nodes whose values appeared in pairs. …
1726. Tuple with Same Product
#Problem Given an array nums of distinct positive integers, return the number of tuples (a, b, c, d) such that a * b = c * d where a, b, c, and d are elements of nums, and a != b != c != d. …
1728. Cat and Mouse II
#Problem A game is played by a cat and a mouse named Cat and Mouse. The environment is represented by a grid of size rows x cols, where each element is a wall, floor, player (Cat, Mouse), or food. Players are represented by the characters …
1742. Maximum Number of Balls in a Box
#Problem You are working in a ball factory where you have n balls numbered from lowLimit up to highLimit inclusive (i.e., n == highLimit - lowLimit + 1), and an infinite number of boxes numbered from 1 to infinity. Your job at this factory …
1749. Maximum Absolute Sum of Any Subarray
#Problem You are given an integer array nums. The absolute sum of a subarray [numsₗ, numsₗ₊₁, ..., numsᵣ₋₁, numsᵣ] is abs(numsₗ + numsₗ₊₁ + ... + numsᵣ₋₁ + numsᵣ). Return the maximum absolute sum of any (possibly empty) subarray of nums. …
1752. Check if Array Is Sorted and Rotated
#Problem Given an array nums, return true if the array was originally sorted in non-decreasing order, then rotated some number of positions (including zero). Otherwise, return false. There may be duplicates in the original array. Note: An …