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.
Cut the sticks
Cut the sticks
Sort by
recency
|
2122 Discussions
|
Please Login in order to post a comment
This is my c++ solution of this problem, you can watch the explanation here : https://youtu.be/jZPhE_MTkVg
python solution: def cutTheSticks(arr): # Write your code here res_op = [] for i in range(len(arr)): if len(arr) == 0: break else: res_op.append(len(arr)) min_val = min(arr) arr = [ (i- min_val) for i in arr if i - min_val > 0] return res_op
My python3 solution
My C++ Solution: (open for feedbacks)
another solution