CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes302downloads
1{2    "id": 2266,3    "name": "minimum_cost_to_set_cooking_time",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/minimum-cost-to-set-cooking-time/",6    "date": "1642809600000",7    "task_description": "A generic microwave supports cooking times for: at least `1` second. at most `99` minutes and `99` seconds. To set the cooking time, you push **at most four digits**. The microwave normalizes what you push as four digits by **prepending zeroes**. It interprets the **first** two digits as the minutes and the **last** two digits as the seconds. It then **adds** them up as the cooking time. For example, You push `9` `5` `4` (three digits). It is normalized as `0954` and interpreted as `9` minutes and `54` seconds. You push `0` `0` `0` `8` (four digits). It is interpreted as `0` minutes and `8` seconds. You push `8` `0` `9` `0`. It is interpreted as `80` minutes and `90` seconds. You push `8` `1` `3` `0`. It is interpreted as `81` minutes and `30` seconds. You are given integers `startAt`, `moveCost`, `pushCost`, and `targetSeconds`. **Initially**, your finger is on the digit `startAt`. Moving the finger above **any specific digit** costs `moveCost` units of fatigue. Pushing the digit below the finger **once** costs `pushCost` units of fatigue. There can be multiple ways to set the microwave to cook for `targetSeconds` seconds but you are interested in the way with the minimum cost. Return _the **minimum cost** to set_ `targetSeconds` _seconds of cooking time_. Remember that one minute consists of `60` seconds. **Example 1:** ``` **Input:** startAt = 1, moveCost = 2, pushCost = 1, targetSeconds = 600 **Output:** 6 **Explanation:** The following are the possible ways to set the cooking time. - 1 0 0 0, interpreted as 10 minutes and 0 seconds. The finger is already on digit 1, pushes 1 (with cost 1), moves to 0 (with cost 2), pushes 0 (with cost 1), pushes 0 (with cost 1), and pushes 0 (with cost 1). The cost is: 1 + 2 + 1 + 1 + 1 = 6. This is the minimum cost. - 0 9 6 0, interpreted as 9 minutes and 60 seconds. That is also 600 seconds. The finger moves to 0 (with cost 2), pushes 0 (with cost 1), moves to 9 (with cost 2), pushes 9 (with cost 1), moves to 6 (with cost 2), pushes 6 (with cost 1), moves to 0 (with cost 2), and pushes 0 (with cost 1). The cost is: 2 + 1 + 2 + 1 + 2 + 1 + 2 + 1 = 12. - 9 6 0, normalized as 0960 and interpreted as 9 minutes and 60 seconds. The finger moves to 9 (with cost 2), pushes 9 (with cost 1), moves to 6 (with cost 2), pushes 6 (with cost 1), moves to 0 (with cost 2), and pushes 0 (with cost 1). The cost is: 2 + 1 + 2 + 1 + 2 + 1 = 9. ``` **Example 2:** ``` **Input:** startAt = 0, moveCost = 1, pushCost = 2, targetSeconds = 76 **Output:** 6 **Explanation:** The optimal way is to push two digits: 7 6, interpreted as 76 seconds. The finger moves to 7 (with cost 1), pushes 7 (with cost 2), moves to 6 (with cost 1), and pushes 6 (with cost 2). The total cost is: 1 + 2 + 1 + 2 = 6 Note other possible ways are 0076, 076, 0116, and 116, but none of them produces the minimum cost. ``` **Constraints:** `0 <= startAt <= 9` `1 <= moveCost, pushCost <= 105` `1 <= targetSeconds <= 6039`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "startAt = 1, moveCost = 2, pushCost = 1, targetSeconds = 600",12            "output": "6 "13        },14        {15            "label": "Example 2",16            "input": "startAt = 0, moveCost = 1, pushCost = 2, targetSeconds = 76",17            "output": "6 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                7,24                71964,25                50245,26                472127            ],28            "output": 41687229        },30        {31            "input": [32                6,33                91933,34                82787,35                397836            ],37            "output": 51501438        },39        {40            "input": [41                8,42                557,43                34344,44                538445            ],46            "output": 13849047        },48        {49            "input": [50                7,51                5088,52                70480,53                35854            ],55            "output": 22161656        },57        {58            "input": [59                7,60                35988,61                89071,62                580763            ],64            "output": 50023665        },66        {67            "input": [68                5,69                46652,70                46124,71                533172            ],73            "output": 32445274        },75        {76            "input": [77                3,78                88643,79                80681,80                80981            ],82            "output": 67729683        },84        {85            "input": [86                3,87                15189,88                6466,89                498490            ],91            "output": 8662092        },93        {94            "input": [95                9,96                14158,97                13109,98                603899            ],100            "output": 66594101        },102        {103            "input": [104                5,105                83324,106                22235,107                2554108            ],109            "output": 422236110        }111    ],112    "haskell_template": "minCostSetTime :: Int -> Int -> Int -> Int -> Int\nminCostSetTime startAt moveCost pushCost targetSeconds ",113    "ocaml_template": "let minCostSetTime (startAt: int) (moveCost: int) (pushCost: int) (targetSeconds: int) : int =  ",114    "scala_template": "def minCostSetTime(startAt: Int,moveCost: Int,pushCost: Int,targetSeconds: Int): Int = { \n    \n}",115    "java_template": "public static int minCostSetTime(int startAt, int moveCost, int pushCost, int targetSeconds) {\n\n}",116    "python_template": "class Solution(object):\n    def minCostSetTime(self, startAt, moveCost, pushCost, targetSeconds):\n        \"\"\"\n        :type startAt: int\n        :type moveCost: int\n        :type pushCost: int\n        :type targetSeconds: int\n        :rtype: int\n        \"\"\"\n        "117}