My codes for Dr Chrono Challenge
They store their rocks in a box with partitions where each partition contains a specific type of rock.
The partitions are numbered from 0 to n 1 where each partition i contains quantity, the number of rocks.
Both, Jamie and Ned have the box with same partitions.
Jamie's box is arranged in a random order whereas Ned's box is arranged in a sorted order.
Geoffrey joins them and observes that the number of rocks in the th partition of his box is the sum of number of rocks in Jamie's ith partition and number of rocks in Ned's ith partition. Find the most frequently curring quantity in Geoffrey's box and return the highest index of the partition with that quantity.
Note:
- The partitions are 0 indexed.
- If two or more quantities have the same frequency, then consider the highest quantity among them
It must return an integer denoting the highest index of the partition containing the most frequently occurring quantity in Geoffrey's box.
Locked stub code in the editor reads the following input from stdin and passes it to the function: The first line contains an integer, n, denoting the number of types of rocks.
Each line i of the n subsequent lines contains integers denoting the number of each type of rock in Jamie's box.
Return an integer denoting the highest index of the partition containing the most frequently occurring quantity in Geoffrey's box.
6
5
5
9
19
2
2