We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hi everyone,
my solution not passing test 5 & 6. Any clue why? Thanks in advance.
publicstaticList<Integer>cutTheSticks(List<Integer>arr){// Write your code hereList<Integer>results=newArrayList<>();Collections.sort(arr);results.add(arr.size());for(inti=1;i<arr.size();i++){if(arr.get(i)!=arr.get(i-1)){results.add(arr.size()-i);}}returnresults;}
Cookie support is required to access HackerRank
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 →
Hi everyone, my solution not passing test 5 & 6. Any clue why? Thanks in advance.