2
* @param {number} startAt3
* @param {number} moveCost4
* @param {number} pushCost5
* @param {number} targetSeconds8
var minCostSetTime = function (startAt, moveCost, pushCost, targetSeconds) {11
let maxMinutes = Math.floor(targetSeconds / 60);13
for (let min = 0; min <= maxMinutes; min++) {14
let secs = targetSeconds - min * 60;16
if (secs > 99 || min > 99) continue;18
let buttons = String(100 * min + secs);19
let prev = Number(buttons[0]);23
//start index will vary according to startAt pointer26
//If startAt is equal to first button, we need to add pushCost fatigue27
if (prev === startAt) {31
//Else we need to add moveCost fatigue35
for (let i = start; i < buttons.length; i++) {36
let button = Number(buttons[i]);38
if (button !== prev) {39
sum += moveCost + pushCost;47
cost = Math.min(cost, sum);