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.
The python solution posted in Editorial is needlessly convoluted by reversing the array numerous times, which can be avoided altogether, using a cleaner (N - value) approach.
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
The python solution posted in
Editorial
is needlessly convoluted by reversing the array numerous times, which can be avoided altogether, using a cleaner(N - value)
approach.You can check out this solution here
Also for very large N, the array could be sorted instead of using the array as a counter directly, which brings down the space complexity.