Smart Gardener (Intuit India)

Smart Gardener (Intuit India) coding interview problem: You are given a garden of length N with sprinklers at positions 0..N, each having a watering range and a cost. Choose which sprinklers to turn on so the entire x-axis segment [0, N] is covered at the minimum total cost, or return -1 if it’s impossible. A common interview question asked in Intuit interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: