Medium · Math
Minimum Cost to Set Cooking Time
Given the key startAt under your finger, the cost moveCost of moving to a different key, the cost pushCost of pressing a key, and targetSeconds, return the minimum cost to set a microwave to targetSeconds, where up to four typed digits are read as mm:ss (minutes and seconds each 0–99).
Examples
Example 1
{
"startAt": 1,
"moveCost": 2,
"pushCost": 1,
"targetSeconds": 600
}Output: min cost 6
Example 2
{
"startAt": 0,
"moveCost": 1,
"pushCost": 2,
"targetSeconds": 76
}Output: min cost 6
Rebuild it in the studio
Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.