Minimum Taps to Water a Garden
A garden spans [0, n]. Tap i (0..n) at position i waters [i - r[i], i + r[i]]. Print the minimum number of taps to water the whole garden, or -1.
Constraints
1 <= n <= 10^4
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.