CoolFace
Datasetpublic

FPEvalDataset/LeetCodeProblem

sourceHugging Faceupdated 8mo agoView on Hugging Face
0likes304downloads
1{2    "id": 3183,3    "name": "find_the_k_or_of_an_array",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/find-the-k-or-of-an-array/",6    "date": "2023-10-22 00:00:00",7    "task_description": "You are given an integer array `nums`, and an integer `k`. Let's introduce **K-or** operation by extending the standard bitwise OR. In K-or, a bit position in the result is set to `1` if at least `k` numbers in `nums` have a `1` in that position. Return _the K-or of_ `nums`. **Example 1: ** **Input:** nums = [7,12,9,8,9,15], k = 4 **Output:** 9 **Explanation: ** Represent numbers in binary: Number Bit 3 Bit 2 Bit 1 Bit 0 7 0 1 1 1 12 1 1 0 0 9 1 0 0 1 8 1 0 0 0 9 1 0 0 1 15 1 1 1 1 Result = 9 1 0 0 1 Bit 0 is set in 7, 9, 9, and 15. Bit 3 is set in 12, 9, 8, 9, and 15. Only bits 0 and 3 qualify. The result is `(1001)2 = 9`. **Example 2: ** **Input:** nums = [2,12,1,11,4,5], k = 6 **Output:** 0 **Explanation: **No bit appears as 1 in all six array numbers, as required for K-or with `k = 6`. Thus, the result is 0. **Example 3: ** **Input:** nums = [10,8,5,9,11,6,8], k = 1 **Output:** 15 **Explanation: ** Since `k == 1`, the 1-or of the array is equal to the bitwise OR of all its elements. Hence, the answer is `10 OR 8 OR 5 OR 9 OR 11 OR 6 OR 8 = 15`. **Constraints:** `1 <= nums.length <= 50` `0 <= nums[i] < 231` `1 <= k <= nums.length`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "nums = [7,12,9,8,9,15], k = 4",12            "output": "9 "13        },14        {15            "label": "Example 2",16            "input": "nums = [2,12,1,11,4,5], k = 6",17            "output": "0 "18        },19        {20            "label": "Example 3",21            "input": "nums = [10,8,5,9,11,6,8], k = 1",22            "output": "15 "23        }24    ],25    "private_test_cases": [26        {27            "input": [28                [29                    1648533913,30                    739042202,31                    1785879626,32                    1985895330,33                    1938497179,34                    2083817625,35                    2137906373,36                    607482366,37                    2139497090,38                    1211306194,39                    1451440098,40                    1428018439,41                    355179392,42                    867567273,43                    2007290007,44                    1501370934,45                    714061102,46                    1551074511,47                    96945727,48                    929509622,49                    1135809159,50                    1542988448,51                    1021030478,52                    1242959352,53                    1772533934,54                    1603614193,55                    861175795,56                    692176247,57                    783353194,58                    1959591709,59                    1126162555,60                    413087829,61                    1626623018,62                    581408378,63                    1442945698,64                    633498962,65                    1852561910,66                    29718451,67                    2137636253,68                    1060254606,69                    888942654,70                    835212530,71                    939145787,72                    1896614077,73                    1263802661,74                    273957592,75                    185269437,76                    978551731,77                    80871790,78                    188895597379                ],80                2881            ],82            "output": 80570385883        },84        {85            "input": [86                [87                    2094801774,88                    1000003706,89                    191401077,90                    1868250690,91                    605058572,92                    921207058,93                    110886273,94                    689524381,95                    472397659,96                    1245355819,97                    1072622617,98                    1667855563,99                    2086101028,100                    931461741,101                    133668135,102                    2109255919,103                    1695455737,104                    1722743835,105                    1838888788,106                    930017017,107                    1334348148108                ],109                6110            ],111            "output": 2147483647112        },113        {114            "input": [115                [116                    780191350,117                    168140646,118                    420936058,119                    660984487,120                    1379018316,121                    1070351316,122                    2024236353,123                    1543888836,124                    928825715,125                    1703029791,126                    40575574,127                    417080673,128                    64194965,129                    1862754202,130                    1980953670,131                    2065477099,132                    910678444,133                    2005368361,134                    1660920801,135                    868634784,136                    2018768963,137                    1402325776,138                    651576894,139                    394607141,140                    398561412,141                    858830101,142                    1165775403,143                    58668551,144                    1560537929,145                    450187698,146                    639051754,147                    2022159395,148                    875922139,149                    1961386762,150                    132214857,151                    862684027,152                    1619425974,153                    1003938876,154                    5501992,155                    1128727545,156                    565440000,157                    88124935,158                    861374235,159                    392879118160                ],161                19162            ],163            "output": 936900463164        },165        {166            "input": [167                [168                    731755076,169                    2053086872,170                    1018575628,171                    1730381497,172                    43893839,173                    612083294,174                    703689179,175                    444252405,176                    1498243595,177                    360790673,178                    1259742586,179                    817182236,180                    1675763739,181                    1306519799,182                    1363720032,183                    871373105,184                    377711529,185                    808812862,186                    871458331,187                    393291355,188                    972729127,189                    2104553726,190                    1153137437,191                    294332286,192                    350472015,193                    1786896387,194                    1306022224,195                    3997152,196                    460678106,197                    965517784,198                    1444058629,199                    63191524,200                    8617759,201                    699512756,202                    1023331984,203                    607409727,204                    1346067472,205                    367806211,206                    230240860,207                    194385732,208                    668640959,209                    1570392269,210                    1059119747,211                    485851950,212                    1894253672,213                    1796983586214                ],215                30216            ],217            "output": 1048576218        },219        {220            "input": [221                [222                    1556185915,223                    1742521476,224                    910647702,225                    1292062328,226                    1782772531,227                    489573838,228                    1467627381,229                    676127857230                ],231                7232            ],233            "output": 0234        },235        {236            "input": [237                [238                    1718071414,239                    481017583,240                    1122611758241                ],242                3243            ],244            "output": 2207782245        },246        {247            "input": [248                [249                    774289984,250                    1107889849,251                    1944693499,252                    123988584,253                    279943207,254                    321549421,255                    1546515350,256                    1650394480,257                    1154249583,258                    2144325791,259                    1144650598,260                    1812138164,261                    1305848768262                ],263                6264            ],265            "output": 1181743871266        },267        {268            "input": [269                [270                    932048731,271                    834954976,272                    367798176,273                    1312529812,274                    2135133903,275                    1942612593,276                    1796801727,277                    1353590884,278                    458122298,279                    968110358,280                    733219568,281                    1809671562,282                    878498281,283                    1232321444,284                    244260500,285                    1965914122,286                    722750073,287                    1613109056,288                    1100993663,289                    755259826,290                    47073101,291                    26382134,292                    1629490391,293                    1165988131,294                    1659637168,295                    1538913622,296                    1698379066,297                    1851309574,298                    479783505,299                    675137206,300                    1502854334,301                    833814313,302                    1578325030,303                    134312159,304                    1008333081305                ],306                8307            ],308            "output": 2147483647309        },310        {311            "input": [312                [313                    1351135357,314                    1801100179,315                    34046474,316                    1706030497,317                    1130603189,318                    1321701310,319                    1783698784,320                    382909781,321                    1207500583,322                    676964322,323                    1776779489,324                    588379453325                ],326                9327            ],328            "output": 32800329        },330        {331            "input": [332                [333                    1109556741,334                    103117037,335                    1276252326,336                    1337135593,337                    2000887681,338                    1542568715,339                    93177720,340                    2109961163,341                    456991723,342                    14204409,343                    1788721494,344                    512407261,345                    567120814,346                    1723802788,347                    78697697,348                    1534889556,349                    85593034,350                    694539394,351                    1418193236,352                    1387368708,353                    779466997,354                    2043843957,355                    1102944849,356                    693907617,357                    900572384,358                    561390851,359                    1551069353,360                    1523626582,361                    761004254,362                    970594629,363                    1436389288364                ],365                5366            ],367            "output": 2147483647368        }369    ],370    "haskell_template": "findKOr :: [Int] -> Int -> Int\nfindKOr nums k ",371    "ocaml_template": "let findKOr (nums: int list) (k: int) : int =  ",372    "scala_template": "def findKOr(nums: List[Int],k: Int): Int = { \n    \n}",373    "java_template": "class Solution {\n    public int findKOr(int[] nums, int k) {\n        \n    }\n}",374    "python_template": "class Solution(object):\n    def findKOr(self, nums, k):\n        \"\"\"\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        \"\"\"\n        "375}