Rope Cutting
Submissions: 1977   Accuracy:


  Difficulty: Easy   Marks: 2

You are given N ropes. A cut operation is performed on ropes such that all of them are reduced by the length of the smallest rope. Display the number of ropes left after every cut operation till the length of each rope is zero.

Input: The first line of input contains integer T denoting the number of test cases. For each test case, there is a line containing the integer N(no of ropes) followed by the N space separated elements(length of rope).

Output: For each test case, print the number of ropes that are left after each operation with space. IF no ropes left after one operation, in this case, we print 0.




5 1 1 2 3 5
5 1 6 9 8 11 2 2 6 5
4 3 2
9 7 5 3 2 1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Vanshika
Author: Vanshika_pec

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.