Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
SOLVE THIS PROBLEM IN C++
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started