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 using a divide and conquer technique as follows:
Explanation
If there are no more coins to collect, we are done in zero steps. Else, we have two options:
a. Either we collect each column individually,
b. Or, since the bottom few rows are guaranteed to be filled contiguously, we pick as many contiguous rows from the bottom as possible, then solve the remaining coins problem recursively. The remaining coins will be in two separate sets from left to minimum_height and minimum_height + 1 to right. So, two ...