Simple Java solution 0ms - 20 lines with explanation
Explanation3 important things to notice:
Only 2 options to create a given targetSeconds

minutes:seconds
minutes-1:seconds+60


There are some restrictions:

se
# Explanation
3 important things to notice:
- Only 2 options to create a given `targetSeconds`
    1. `minutes`:`seconds`
    2. `minutes-1`:`seconds+60`
- There are some restrictions:
    - `seconds` is max. 99, hence if `seconds` part is more than 39 we cannot add 60, so we can only use option 1.
    - `minutes` may be 0, then we cannot subtract 1, so we can only use option 1.
    - `minutes` may be greater than 99 hence we have to add 60s, so we can only use option 2.
- If we have leading zeros we should skip them to minimize cost

# Code
```java []
class Solution {
    private int startAt, moveCost, pushCost;
    public int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {
        this.startAt = startAt; this.moveCost = moveCost; this.pushCost = pushCost;
        int m = targetSeconds / 60, s = targetSeconds % 60;
        if (s >= 40 || m == 0) return calculateCost(m, s);
        if (m > 99) return calculateCost(m - 1, s + 60);
        return Math.min(calculateCost(m, s), calculateCost(m - 1, s + 60));
    }

    private int calculateCost(int m, int s) {
        var digits = new int[] { m / 10, m % 10, s / 10, s % 10 };
        int prev = startAt, cost = 0;
        for (int digit : digits) {
            if (digit == 0 && cost == 0) continue;
            if (digit != prev) cost += moveCost;
            cost += pushCost;
            prev = digit;
        }
        return cost;
    }
}
```
['Java']