Author: Akshay Kuchhal
Tester: Akshat Jain
Editorialist: Akshat Jain
Interest in Coding, sorting, loops.
We have to calculate minimum number of cakes with strictly decreasing layer sizes.
The problem may be solved by simply counting the largest number layers with a particular radius.
• First line consist of number of test cases, each test case has number of layers and radii of each layer.
• Input in array form and sort that array.
• Now, just count the adjacent repetitions and update the value of max if count comes out to be greater than max(previously largest).
• Display max as the minimum number of cakes to be formulated so as to use all layers and arrange them in strictly decreasing order towards the top.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.
Tester’s solution can be found here.