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.
def cutTheSticks(arr):
# Write your code here
result = []
if len(arr) <= 0:
result.append(0)
return result
arr.sort()
index = 0
while index < len(arr):
result.append(len(arr)-index)
low = index
for i in range(low, len(arr), 1):
if arr[i] == arr[low]:
index += 1
return result
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 →
def cutTheSticks(arr): # Write your code here result = [] if len(arr) <= 0: result.append(0) return result