3171. Find Subarray With Bitwise AND Closest to K | 2 different Approaches | Weekly Leetcode 400

Опубликовано: 29 Март 2026
на канале: codingMohan
1,412
47

Segment Tree Series - https://bit.ly/segment-trees

*************************************************
Contest Link - https://leetcode.com/contest/weekly-c...

Problem Link - https://leetcode.com/contest/weekly-c...
Solution - https://leetcode.com/problems/find-su...

*************************************************
Timestamps -

00:00 - Agenda
01:00 - Problem Description
02:42 - Brute force solution
05:00 - [Approach 1] Thought process to optimise
06:15 - [Approach 1] What to binary search on?
10:06 - [Approach 1] Pseudo code & Time Complexity
13:03 - [Approach 1] Optimising the solution (avoid building "AND" array)
17:02 - [Approach 1] AND [start ... m] using Prefix Sums
20:12 - [Approach 1] Recap of Algorithm
22:10 - [Approach 2] Approach to optimise
23:45 - [Approach 2] Count of distinct values
29:26 - [Approach 2] Finding all distinct values
32:48 - [Approach 2] Time Complexity
36:40 - [Approach 2] Calculating index of Nearest zero
42:40 - [Approach 2] Code Walkthrough

*************************************************
Interview Experiences Playlists -

Microsoft -    • Microsoft Interview Questions  
Amazon -    • Amazon Interview Questions  
D.E.Shaw -    • D.E.Shaw Interview Questions  
Linkedin -    • Linkedin Interview Questions  
Facebook -    • Facebook (Meta) Interview Questions  
*********************************************************************

Please show support and subscribe if you find the content useful.