CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
meta.json97 linesDownload Raw Back to minimum_array_end
1{2    "id": 3394,3    "name": "minimum_array_end",4    "difficulty": "Medium",5    "link": "https://leetcode.com/problems/minimum-array-end/",6    "date": "2024-04-21 00:00:00",7    "task_description": "You are given two integers `n` and `x`. You have to construct an array of **positive** integers `nums` of size `n` where for every `0 <= i < n - 1`, `nums[i + 1]` is **greater than** `nums[i]`, and the result of the bitwise `AND` operation between all elements of `nums` is `x`. Return the **minimum** possible value of `nums[n - 1]`. **Example 1:** **Input:** n = 3, x = 4 **Output:** 6 **Explanation:** `nums` can be `[4,5,6]` and its last element is 6. **Example 2:** **Input:** n = 2, x = 7 **Output:** 15 **Explanation:** `nums` can be `[7,15]` and its last element is 15. **Constraints:** `1 <= n, x <= 108`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "n = 3, x = 4",12            "output": "6 "13        },14        {15            "label": "Example 2",16            "input": "n = 2, x = 7",17            "output": "15 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                1,24                7225            ],26            "output": 7227        },28        {29            "input": [30                3,31                232            ],33            "output": 634        },35        {36            "input": [37                4,38                4239            ],40            "output": 4741        },42        {43            "input": [44                2,45                8046            ],47            "output": 8148        },49        {50            "input": [51                9,52                8553            ],54            "output": 21355        },56        {57            "input": [58                7,59                6360            ],61            "output": 44762        },63        {64            "input": [65                2,66                7267            ],68            "output": 7369        },70        {71            "input": [72                5,73                9374            ],75            "output": 22176        },77        {78            "input": [79                3,80                3781            ],82            "output": 4583        },84        {85            "input": [86                4,87                688            ],89            "output": 1590        }91    ],92    "haskell_template": "minEnd :: Int -> Int -> Int\nminEnd n x ",93    "ocaml_template": "let minEnd (n: int) (x: int) : int =  ",94    "scala_template": "def minEnd(n: Int,x: Int): Int = { \n    \n}",95    "java_template": "class Solution {\n    public long minEnd(int n, int x) {\n        \n    }\n}",96    "python_template": "class Solution(object):\n    def minEnd(self, n, x):\n        \"\"\"\n        :type n: int\n        :type x: int\n        :rtype: int\n        \"\"\"\n        "97}