Content-Length: 261225 | pFad | http://github.com/ramtanniru/Leetcode/commit/ad2b23c4ff085ea3f89cf39206247e772a4cb3e7

8B 3097 · ramtanniru/Leetcode@ad2b23c · GitHub
Skip to content

Commit ad2b23c

Browse files
committed
3097
1 parent 24cb699 commit ad2b23c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Nov-10-24.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def minimumSubarrayLength(self, nums: List[int], k: int) -> int:
3+
bits = {}
4+
ans = inf
5+
for i,x in enumerate(nums):
6+
bits = {_or | x : left for _or,left in bits.items()}
7+
bits[x] = i
8+
for _or,left in bits.items():
9+
if _or >= k:
10+
ans = min(ans,i-left+1)
11+
return ans if ans!=inf else -1

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ramtanniru/Leetcode/commit/ad2b23c4ff085ea3f89cf39206247e772a4cb3e7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy