Given an array of size N, print the length of the longest subarray such that the Bitwise OR of all the elements of the subarray is less than or equal to K.
If no such subarray exists, print 0.
A subbarray is a contiguous part of array. Consider the array [1, 2, 3, 4], the subarrays are (1), (2), (3), (4), (1,2), (2,3), (3,4), (1,2,3), (2,3,4) and (1,2,3,4) while (1, 3), (1,2,4) etc are not its subarrays.
Input:
Output:
Constraints:
Subtasks:
Subtask 1 (20 points)
Subtask 2 (30 points)
Subtask 3 (50 points)
In the first test case the longest subarray is [1 5 3 2 7] (Bitwise OR = 7)
In the second case the longest subarray is [12 12 12 12 12] (Bitwise OR = 12)