Easy java solution 1ms solution
There are atmost two possible combinations for any targetSeconds\n\teg. targetSeconds = 745\n\tminutes = 745/60 = 12;\n\tseconds = 745%12 = 25;\n\t=> first comb
1. There are atmost two possible combinations for any targetSeconds\n\teg. targetSeconds = 745\n\tminutes = 745/60 = 12;\n\tseconds = 745%12 = 25;\n\t=> first combination 12:25\n\t\n\tNow since after adding 60 to seconds, it wont exceed 99, we can have\n\tcombination of (minutes-1, seconds+60)\n\t=> second combination 11:85\n\t\n\tcost = min(costOfFirstCombination, costOfSecondCombination);\n\t\n\tInside findCost function, we first store the minutes and seconds in an array\n\ttime[] = {1,2,2,5}\n\t-If we initially have any zeroes, we leave them as it is\n\t-If start is same as current digit, we don\'t need to move, we just need to push that button\n\t-if start is not same as current digit, then we need to do both, move and push , so we add both of its cost\n\t-and we set the startAt as the current digit, so if the next digit is same as the current digit, we don\'t move anywhere.\n\n```\nclass Solution {\n    public int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {\n        int minutes = targetSeconds/60;\n        int seconds = targetSeconds%60;\n        int cost = Integer.MAX_VALUE;\n\n        cost = Math.min(\n                findCost(minutes, seconds, startAt, moveCost, pushCost),\n                findCost(minutes-1, seconds+60, startAt, moveCost, pushCost)); \n\t\t\t\n        return cost;\n    }\n    \n    int findCost(int minutes, int seconds, int startAt, int moveCost, int pushCost){\n        if(minutes>99 || seconds>99) return Integer.MAX_VALUE;\n        int[] time = new int[4];\n        time[1] = minutes%10;\n        time[0] = minutes/10;\n        \n        time[3] = seconds%10;\n        time[2] = seconds/10;\n        \n        boolean flag = false; \n        //flag for checking if first digit occured\n\t\t//so that we skip only the trailing zeroes, not the inclusive zeroes\n        //00:76, if this is the case, we need to ignore first two zeroes\n        //12:00, we can\'t ignore any zeroes here\n        //09:60, we just ignore first zero\n        int cost = 0;\n        \n        for(int i=0; i<4; i++){\n            if(time[i]==0 && !flag){\n                continue;\n            }\n            else if(time[i]==startAt){\n                flag = true;\n                cost += pushCost;\n            }\n            else{\n                flag = true;\n                cost += pushCost + moveCost;\n                startAt = time[i];\n            }\n        }\n        \n        return cost;     \n    }\n}\n```
['Java']