C++ easy to understand solution
Convert time to string and ignore the starting 0\'s. There are two ways:\n1. min + sec\n2. (min-1) + (sec+60)  , (if min > 0 && sec < 40)\n3. return minimum cos
Convert time to string and ignore the starting 0\'s. There are two ways:\n1. min + sec\n2. (min-1) + (sec+60)  , (if min > 0 && sec < 40)\n3. return minimum cost for these two\n\n```\nclass Solution {\npublic:\n    int getcost(int startAt, int moveCost, int pushCost, string& str) {\n        if(str.empty()) return INT_MAX;\n        int ret = 0;\n        for(auto &c : str) {\n            if(c - \'0\' == startAt) ret += pushCost;\n            else {\n                ret += moveCost + pushCost;\n                startAt = c - \'0\';\n            }\n        }\n        return ret;\n    }\n    \n    int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {\n        int min = targetSeconds  / 60;\n        int sec = targetSeconds  % 60;\n        \n        if(min > 99) {\n            min = 99;\n            sec += 60;\n        }\n        \n        // convert time to string ignoring starting 0\'s\n        string str1(""), str2("");\n        \n        if(min) {\n            if(sec < 10)    str1 = to_string(min) + "0" + to_string(sec);\n            else            str1 = to_string(min) + to_string(sec);\n        } else {\n            str1 = to_string(sec);\n        }\n        \n        if(min && sec < 40) {\n            if(min-1)   str2 = to_string(min-1) + to_string(sec+60);\n            else        str2 = to_string(sec+60);\n        }\n        \n        int x = getcost(startAt, moveCost,pushCost, str1);\n        int y = getcost(startAt, moveCost, pushCost, str2);\n        \n        return std::min(x, y);\n    }\n};\n```
['C', 'C++']