Solution: Collect Coins in Minimum Steps
This review discusses the solution of the collect coins in minimum steps challenge in detail.
We'll cover the following...
We'll cover the following...
Solution
We can solve this problem by implementing the divide and conquer algorithm as follows:
Explanation
If we start horizontally from the bottom, we can get rid of the minimum height coin rows, while collecting the maximum possible number of coins because the bottom rows are guaranteed to be filled.
Suppose that we are working on the coin stacks from the left stack, say left, to the right stack, right, in each recursion step.
-
Choose the minimum height index
min. Removeminhorizontal lines after which the stack will be broken into ...