File size: 7,210 Bytes
24e07f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
{
    "id": 3246,
    "name": "check_if_bitwise_or_has_trailing_zeros",
    "difficulty": "Easy",
    "link": "https://leetcode.com/problems/check-if-bitwise-or-has-trailing-zeros/",
    "date": "2023-12-24 00:00:00",
    "task_description": "You are given an array of **positive** integers `nums`. You have to check if it is possible to select **two or more** elements in the array such that the bitwise `OR` of the selected elements has **at least **one trailing zero in its binary representation. For example, the binary representation of `5`, which is `\"101\"`, does not have any trailing zeros, whereas the binary representation of `4`, which is `\"100\"`, has two trailing zeros. Return `true` _if it is possible to select two or more elements whose bitwise_ `OR` _has trailing zeros, return_ `false` _otherwise_. **Example 1:** ``` **Input:** nums = [1,2,3,4,5] **Output:** true **Explanation:** If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation \"110\" with one trailing zero. ``` **Example 2:** ``` **Input:** nums = [2,4,8,16] **Output:** true **Explanation: **If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation \"110\" with one trailing zero. Other possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16). ``` **Example 3:** ``` **Input:** nums = [1,3,5,7,9] **Output:** false **Explanation:** There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR. ``` **Constraints:** `2 <= nums.length <= 100` `1 <= nums[i] <= 100`",
    "public_test_cases": [
        {
            "label": "Example 1",
            "input": "nums = [1,2,3,4,5]",
            "output": "true "
        },
        {
            "label": "Example 2",
            "input": "nums = [2,4,8,16]",
            "output": "true "
        },
        {
            "label": "Example 3",
            "input": "nums = [1,3,5,7,9]",
            "output": "false "
        }
    ],
    "private_test_cases": [
        {
            "input": [
                38,
                96,
                54,
                93,
                34,
                65,
                95,
                25,
                63,
                49,
                32,
                96,
                5,
                46,
                95,
                16,
                53,
                25,
                1,
                84,
                18,
                3,
                91,
                20,
                63,
                11,
                71,
                63,
                63,
                2,
                98,
                68
            ],
            "output": true
        },
        {
            "input": [
                17,
                64,
                92,
                91,
                94,
                66,
                87,
                91,
                18,
                44,
                65,
                37,
                41,
                16,
                38,
                74,
                91,
                37,
                38,
                36,
                9,
                4,
                7,
                75,
                3
            ],
            "output": true
        },
        {
            "input": [
                73,
                56,
                23,
                72,
                18,
                92,
                82,
                54,
                87,
                3,
                1,
                77,
                70,
                15,
                24,
                72,
                47,
                27,
                82,
                11,
                87,
                21,
                47,
                75,
                53,
                3,
                21,
                4,
                84,
                64,
                4,
                36,
                52,
                40,
                80,
                86,
                25,
                74,
                1,
                2,
                90,
                35,
                5,
                82,
                45,
                59,
                78,
                1,
                56,
                16,
                63,
                69,
                86,
                65,
                62,
                8,
                54,
                92,
                35
            ],
            "output": true
        },
        {
            "input": [
                26,
                41,
                28,
                25,
                23,
                11,
                71,
                31,
                38,
                23,
                58,
                87,
                51,
                80,
                73,
                53,
                69,
                94,
                65,
                73,
                92,
                96,
                82,
                89,
                33,
                51,
                68,
                16,
                73,
                92,
                7,
                13,
                25,
                35,
                42,
                34,
                3,
                45,
                84,
                73,
                47,
                60,
                83,
                16,
                94,
                85,
                90,
                19,
                58,
                32,
                29,
                2,
                19,
                90,
                80,
                60,
                21,
                64,
                21,
                50,
                27,
                8,
                71,
                59,
                19,
                55,
                13,
                31,
                92,
                36,
                90,
                44,
                29,
                88
            ],
            "output": true
        },
        {
            "input": [
                3,
                80,
                72,
                87,
                40,
                47,
                92,
                43,
                47,
                27,
                51,
                14,
                23
            ],
            "output": true
        }
    ],
    "haskell_template": "hasTrailingZeros :: [Int] -> Bool\nhasTrailingZeros nums ",
    "ocaml_template": "let hasTrailingZeros (nums: int list) : bool =  ",
    "scala_template": "def hasTrailingZeros(nums: List[Int]): Boolean = { \n    \n}",
    "java_template": "class Solution {\n    public boolean hasTrailingZeros(int[] nums) {\n        \n    }\n}",
    "python_template": "class Solution(object):\n    def hasTrailingZeros(self, nums):\n        \"\"\"\n        :type nums: List[int]\n        :rtype: bool\n        \"\"\"\n        "
}