#3095
Shortest Subarray With OR at Least K I
easy · 44.2% accepted · 139 likes · top 26%
array · bit manipulation · sliding window
Description
You are given an array nums of non-negative integers and an integer k.
An array is called special if the bitwise OR of all of its elements is at least k.
Return the length of the shortest special non-empty subarray of nums, or return -1 if no special subarray exists.
Solution