You are in charge of a linear parking lot. There are n
cars parked permanently in this
parking lot. The i
th car occupies the pos[i]
th parking slot.
You feel bad for the car owners of these cars, so you decided to build a roof
to cover k
cars from the rain. Why build just a singular roof and why only cover k
cars
instead of every car? You didn't get paid enough for this.
This is a companion discussion topic for the original entry at https://algo.monster/problems/twitter_oa_parking_dilemma/