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.
defcutTheSticks(arr):# Write your code herearr=sorted(arr,reverse=True)res=[len(arr)]currVal=arr[-1]whilelen(arr)>0:ifcurrVal!=arr[-1]:res.append(len(arr))currVal=arr[-1]arr.pop(-1)returnres
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 →
Python3 Solution