Medium · Math

Minimum Cost to Set Cooking Time

Given startAt in [0, 9], moveCost and pushCost in [0, 10⁵], and targetSeconds in [0, 6039], return the minimum cost to set a microwave to targetSeconds. 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

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems