# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

You are given an array **A** of **n** integers and an integer **k**. You need to find if there is **any** non-empty subset in the array such that the bitwise AND of all integers in the subset is less than **k** or not.

The first line contains an integer **t(1 ≤ t ≤ 50)**, the number of test cases.

For each test case, the first line contains two integers **n(1 ≤ n ≤ 10 ^{5}) , k(0 ≤ k ≤ 10^{9})** and the next line contains

It is guaranteed that the sum of lengths of all given arrays doesn’t exceed **5*10 ^{5}**.

Output “YES”(without quotes) if there is any subset in the array such that the bitwise AND of all integers in the subset is less than **k** and output “NO”(without quotes) otherwise.

Input | Output |
---|---|

2 2 3 1 1 1 2 4 | YES NO |

84% Solution Ratio

SwampFireEarliest,

RamprosadGFastest, 0.0s

SwampFireLightest, 131 kB

Mr_BangladeshShortest, 220B

Login to submit