Greenhouse and Plants
You have a Greenhouse of height $x$ units (i.e plants with height > $x$ cannot be kept inside it) and $n$ plants whose initial heights are $h_1, h_2…,h_n$. These plants are of a special kind: they grow by 1 unit if watered. You have to keep these plants in the greenhouse for at most $d$ days. On the $i$’th day, you have to water exactly $a_i$ different plants. You need to output the maximum num
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start