Python 3   ||   8 lines, strings   ||   T/S: 97% / 99%
\nclass Solution:\n    def minCostSetTime(self, startAt: int, moveCost: int,\n                             pushCost: int, targetSeconds: int) -> int:\n\n       
```\nclass Solution:\n    def minCostSetTime(self, startAt: int, moveCost: int,\n                             pushCost: int, targetSeconds: int) -> int:\n\n        def cost(m: int,s: int)-> int:\n\n            if not(0 <= m <= 99 and 0 <= s <= 99): return inf\n\n            display = str(startAt) + str(100*m+s)\n\n            moves  = sum(display[i] != display[i-1] for i in range(1,len(display)))\n            pushes = len(display) - 1\n            \n            return moveCost*moves + pushCost*pushes\n        \n\n        mins, secs = divmod(targetSeconds,60)\n            \n        return  min(cost(mins,secs),cost(mins-1,secs+60))\n```\n[https://leetcode.com/problems/minimum-cost-to-set-cooking-time/submissions/925094755/](https://leetcode.com/problems/minimum-cost-to-set-cooking-time/submissions/925094755/)\n\nI could be wrong, but I think that time complexity is *O*(1) and space complexity is *O*(1).\n
['Python3']