Question: Growth in 2 Dimensions Start with an infinite two dimensional grid filled with zeros, indexed from ( 1 , 1 ) at the bottom left
Growth in Dimensions
Start with an infinite two dimensional grid filled with zeros, indexed from 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 cis the ending column, add to each element in the range from 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 below
countMax has the following parameters: string uplightin: an array of strings made of two spaceseparated integers, rand c
Return
long: the number of occurrences of the final grid's maximal element Constraints
sns
s number of rows, number of columns & To
D
Input Format for Custom Testing
Input from stain will be processed as follows and passed to the function.
The first line contains an integer n the size of the array upRight Each of the next in lines contains a string of two spaceseparated integers representing coordinates rand for element upRight
Sample Case
Sample Input
STOIN
Function
upRight size
upright
ALL
Sample Output
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
