Question: SOLVE THIS PROBLEM IN C++ INPUT: 4 4 3 4 1 2 3 2 7 1 8 4 5 4 1 2 3 3 1
SOLVE THIS PROBLEM IN C++
INPUT: 4 4 3 4 1 2 3 2 7 1 8 4 5 4 1 2 3 3 1 5 3 1
OUTPUT: 2 1 -1 -1

After reaching your destination, you want to build a new colony on the new planet. Since this planet has many mountains and the colony must be built on a flat surface you decided to flatten the mountains using boulders (you are still dreaming so this makes sense to you). . . You are given an array h1, h2, ..., hn, where h is the height of the i-th mountain, and k the number of boulders you have. You will start throwing boulders from the top of the first mountain one by one and they will roll as follows (let's assume that the height of the current mountain is hi): if hi > hit1, the boulder will roll to the next mountain; if h;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
