Description
Solutions
Growth in 2 Dimensions ๐
๐ฅ FULLTIME๐RELATED PROBLEMS
Start with an infinite two dimensional grid filled with zeros, indexed from (1, 1) at the bottom left corner with coordinates increasing toward the top and right. Given a series of coordinates (r, c), where r is the ending row and c is the ending column, add 1 to each element in the range from (1, 1) to (r, c) inclusive. Once all coordinates are processed, determine how many cells contain the maximal value in the grid.
Function Description
Complete the function countMax
in the editor.
countMax
has the following parameter(s):
String[] upRight
: an array of strings made of two space-separated integers representing r and c respectively
Returns
int
: the number of cells that contain the maximal value
Example 1:
Input: upRight = ["1 4", "2 3", "4 1"]
Output: 1
Explanation:The two space-separated integers within each string representr
andc
respectively. The following diagrams show each iteration starting at zero. The maximal value in the grid is 3, and there is 1 occurrence at cell (1, 1).![]()
Constraints:
Unknown for now

Related Problems
Testcase
Result
Case 1
input:
output: