You are viewing a single comment's thread. Return to all comments →
anyone help me please, my code passes all test case except 5 and 6.
public static List cutTheSticks(List arr) { // Write your code here
Collections.sort(arr); List<Integer> list= new ArrayList<>(); list.add(arr.size());
int i=0;
while(i!=arr.size()-1){
if(arr.get(i)!=arr.get(i+1)){
list.add(arr.size()-(i+1));
}
i++;
} return list; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
anyone help me please, my code passes all test case except 5 and 6.
public static List cutTheSticks(List arr) { // Write your code here
int i=0;
while(i!=arr.size()-1){
if(arr.get(i)!=arr.get(i+1)){
}
i++;