Java | Easy To understand with Explanation | 100%
First Find minutes and seconds from targetSeconds\nlike -> minutes = targetSeconds / 60  and seconds = targetSeconds % 60\n\n\nConsider the condition that minut
First Find minutes and seconds from targetSeconds\nlike -> minutes = targetSeconds / 60  and seconds = targetSeconds % 60\n\n\nConsider the condition that minutes can\'t exceed 99 and similar with seconds\nif minutes > 99 then subtract -1 and add 60 to seconds. \nCreate time number by using the minutes and seconds for better understating check this:\n\n\n![image](https://assets.leetcode.com/users/images/083f41e3-e817-4bc6-95b8-81e7630aaad3_1644090307.6726065.jpeg)\n\nAfter creating the number find its cost by comparing each value with startAt(s)\n* Check Leading Zeros\n* If array value is equal to startAt(s) then add pushCost(p) to the ans \n* Else add moveCost and pushCost to the ans and **don\'t forget to change the startAt(s)**\n\nNow reduce the minutes by 1 and add increment seconds by 60 and do the same proces \n* only If minutes >= 0 and seconds <= 99\n\nafter that compare values and return minimum value.\n\n![image](https://assets.leetcode.com/users/images/36e983c3-ce67-40ec-bbf2-83aa49bad25e_1644090753.7913172.jpeg)\n\n\n\n**Check My Code Below**\n```\nclass Solution {\n    public int minCostSetTime(int s, int m, int p, int target){\n        int ans = Integer.MAX_VALUE;\n        int min = target/60;\n        int sec = target%60;\n        if(min > 99){\n            min -= 1;\n            sec += 60;\n        }\n        while(min >= 0 && sec <= 99){\n            int res = 0;\n            int check = s;\n            int[] arr = new int[4];\n            arr[0] = min/10;\n            arr[1] = min%10;\n            arr[2] = sec/10;\n            arr[3] = sec%10;\n            boolean isZero = false;\n            for(int i=0; i<4; i++){\n                if(arr[i] == 0 && !isZero){\n                    continue;\n                }\n                isZero = true;\n                if(arr[i] == check){\n                    res += p;\n                }\n                else{\n                    res += m + p;\n                    check = arr[i];\n                }\n            }\n            min -= 1;\n            sec += 60;\n            ans = Math.min(res, ans);\n        }\n        return ans;\n    }\n}\n\n```\n\nHope It helps. If you like this Explaination please UpVote ! Happy Coding
['Java']