Garden watering schedule

Write codeMedium15 min

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]) -> int
Example 1
Inputmin_watering_cost([10, 1, 10, 1, 10])
Output2
Example 2
Inputmin_watering_cost([3, 4, 5])
Output4