leetle

Daily challenge for 2026-10-13

651. Minimum Operating Cost

You are managing a system that can run in one of two modes each day. You are given two integer arrays, modeA and modeB, representing the daily operating costs of running the system in Mode A and Mode B, respectively. You are also given an integer switchCost, which is the cost incurred whenever you change modes from one day to the next. You can start in either mode on the first day without paying a switch cost. Return the minimum total cost to operate the system for all days.

Constraints:
The two cost arrays have the same length, from 0 to 200. All daily costs and the switching cost are non-negative integers at most 1,000,000. With no days, return 0.

Example:
Input: modeA = [1, 10, 1], modeB = [10, 1, 10], switchCost = 2
Output: 7

Run this challenge interactively in Python or JavaScript when the app loads.