Showing 3 questions
You're given a binary string and need to find the minimum number of flips to make it monotone increasing (all 0s before all 1s). Determine the fewest changes required to achieve this ordered structure.
#1. Flip String to Monotone Increasing
Given an array of numbers and a threshold, find the smallest divisor that ensures the sum of the divisions (ceiling) is less than or equal to the threshold. You need to efficiently search for this divisor.
#2. Find the Smallest Divisor Given a Threshold
Find the minimum number of swaps needed to group all 1's together in a binary array. Swaps can only happen between adjacent elements.
#3. Minimum Swaps to Group All 1's Together