Code RoomGarden watering schedule
MediumPrep Room Coding #691

Garden watering schedule

CodingAlgorithms & data structuresEntry–Mid~15 min

A community garden needs watering over a season. For each day you are given the cost of hiring someone to water (costs vary by day). The plants survive as long as there are never two consecutive days without watering; any single missed day is fine. You choose which days to hire. Return the minimum total cost of a safe schedule. An empty list costs 0. For example, [10, 1, 10, 1, 10] can skip days 0, 2, and 4 and pay only 2.

Implement
min_watering_cost(costs: list[int]) → int
Examples
in[[10,1,10,1,10]]out2
in[[3,4,5]]out4
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 15 min
InputExpectedGot
[[10,1,10,1,10]]2not run yetsample
[[3,4,5]]4not run yetsample