Minimum Swaps for Lightest-Top Heaviest-Bottom
Asked at Amazon · Coding Questions · Difficulty: Medium
Given `blocks` of distinct weights, using adjacent swaps make the lightest block first and the heaviest block last. Return the minimum number of adjacent swaps.
Loading the problem…