C++ || Simple Approach || Brute Force
IDEA: Generating all possible ways by which we can get the target seconds, as question suggests there is only 4 digit number so its not too difficult to try all
IDEA: Generating all possible ways by which we can get the target seconds, as question suggests there is only 4 digit number so its not too difficult to try all possible ways.\n\nAfter generating all possible ways, just splitting them into digits and calculate the cost.\n\nCode (Easy Understanding):\n- set is because 0543 and 543 should be considered once.\n\n```\nclass Solution {\n    #define debug(x) cout<<#x<<":"<<x<<endl;\n    set<int> generateNumbers(int n){\n        set<int> ss;\n        for(int i=0;i<=9;i++){\n            for(int j=0;j<=9;j++){\n                for(int k = 0;k<=9;k++){\n                    for(int l=0;l<=9;l++){\n                        int minutes = i*10 + j;\n                        int seconds = k*10 + l;\n                        if((minutes*60 + seconds) == n){\n                            ss.insert(minutes*100 + seconds);\n                        }\n                    }\n                }\n            }\n        }\n        return ss;\n    }\n    \n    vector<vector<int>> convert(set<int>& ss){\n        vector<vector<int>> allPossible;\n          for(auto val : ss){\n            vector<int> vec;\n            while(val){\n              vec.push_back(val%10);\n              val = val/10;\n            }\n            reverse(vec.begin(),vec.end());\n            allPossible.push_back(vec);\n          }\n        return allPossible;\n    }\n    \npublic:\n    int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {\n        auto allPossible = generateNumbers(targetSeconds);\n        auto possible = convert(allPossible);\n        vector<int> costs;\n        for(auto& vec:possible){\n            int cost = 0;\n            int st = startAt;\n            for(auto&val:vec){\n                if(st == val){\n                    cost += pushCost;\n                }else{\n                    cost += moveCost;\n                    cost += pushCost;\n                    st = val;\n                }\n            }\n            costs.emplace_back(cost);\n        }\n        return *min_element(costs.begin(),costs.end());\n    }\n};\n```
[]