Garden watering schedule
Your task
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.
Examples
min_watering_cost(costs: list[int]) -> intExample 1
Input
min_watering_cost([10, 1, 10, 1, 10])Output
2Example 2
Input
min_watering_cost([3, 4, 5])Output
4