CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes564downloads
1{2    "id": 3236,3    "name": "smallest_missing_integer_greater_than_sequential_prefix_sum",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/smallest-missing-integer-greater-than-sequential-prefix-sum/",6    "date": "2023-12-23 00:00:00",7    "task_description": "You are given a **0-indexed** array of integers `nums`. A prefix `nums[0..i]` is **sequential** if, for all `1 <= j <= i`, `nums[j] = nums[j - 1] + 1`. In particular, the prefix consisting only of `nums[0]` is **sequential**. Return _the **smallest** integer_ `x` _missing from_ `nums` _such that_ `x` _is greater than or equal to the sum of the **longest** sequential prefix._ **Example 1:** ``` **Input:** nums = [1,2,3,2,5] **Output:** 6 **Explanation:** The longest sequential prefix of nums is [1,2,3] with a sum of 6. 6 is not in the array, therefore 6 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix. ``` **Example 2:** ``` **Input:** nums = [3,4,5,1,12,14,13] **Output:** 15 **Explanation:** The longest sequential prefix of nums is [3,4,5] with a sum of 12. 12, 13, and 14 belong to the array while 15 does not. Therefore 15 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix. ``` **Constraints:** `1 <= nums.length <= 50` `1 <= nums[i] <= 50`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [1,2,3,2,5]",12            "output": "6 "13        },14        {15            "label": "Example 2",16            "input": "nums = [3,4,5,1,12,14,13]",17            "output": "15 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                7,24                17,25                3826            ],27            "output": 828        },29        {30            "input": [31                7,32                24,33                7,34                41,35                18,36                11,37                16,38                1,39                26,40                4141            ],42            "output": 843        },44        {45            "input": [46                12,47                10,48                39,49                28,50                40,51                38,52                33,53                8,54                31,55                14,56                32,57                23,58                48,59                14,60                19,61                43,62                1863            ],64            "output": 1365        },66        {67            "input": [68                11,69                30,70                12,71                12,72                30,73                15,74                13,75                4,76                44,77                20,78                1,79                17,80                28,81                40,82                24,83                9,84                22,85                7,86                23,87                20,88                12,89                37,90                13,91                4,92                47,93                41,94                23,95                1,96                1,97                13,98                9,99                26,100                27,101                21,102                39,103                30,104                42,105                46,106                34,107                50,108                3,109                23110            ],111            "output": 14112        },113        {114            "input": [115                26,116                36,117                4,118                9,119                48,120                36,121                27,122                27,123                48,124                7,125                34,126                37,127                14,128                44,129                16,130                17,131                7,132                26,133                16,134                35135            ],136            "output": 28137        }138    ],139    "haskell_template": "missingInteger :: [Int] -> Int\nmissingInteger nums ",140    "ocaml_template": "let missingInteger (nums: int list) : int =  ",141    "scala_template": "def missingInteger(nums: List[Int]): Int = { \n    \n}",142    "java_template": "class Solution {\n    public int missingInteger(int[] nums) {\n        \n    }\n}",143    "python_template": "class Solution(object):\n    def missingInteger(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: int\n        \"\"\"\n        "144}