2
public int minCostSetTime(int startAt, int moveCost, int pushCost, int tar) {4
int min = tar / 60, sec = tar % 60, minCost = (moveCost + pushCost) * 4;9
} // this is required to do because if tar>=6000 then min is 100 which is not possible as it10
// atmost can be 99mins12
while (min >= 0 && sec <= 99) { // this while loop will work for atmost 2 iterations13
tar = min * 100 + sec;14
char arr[] = ("" + tar).toCharArray();16
for (int i = 0; i < arr.length - 1; i++) if (arr[i] == arr[i + 1]) sameMove++;17
if (startAt == arr[0] - '0')18
minCost = Math.min(minCost, pushCost * arr.length + moveCost * (arr.length - 1 - sameMove));19
else minCost = Math.min(minCost, pushCost * arr.length + moveCost * (arr.length - sameMove));