Smallest Subarrays With Maximum Bitwise OR | Detailed Explanation | Leetcode 2411 | codestorywithMIK
Whatsapp Community Link : https://www.whatsapp.com/channel/0029Va6kVSjICVfiVdsHgi1A
How to check if kth bit of a number is set or not : • DSA Shorts with MIK - 8
Hi Everyone, this is the 27th video of our Playlist "Bit Manipulation : Popular Interview Problems".
Now we will be solving a good bit concept related problem - Smallest Subarrays With Maximum Bitwise OR | Detailed Explanation | Leetcode 2411 | codestorywithMIK
I will explain it in full detail so that it becomes easy to understand. Each line will be explained and you will know the WHY behind everything.
Problem Name : Smallest Subarrays With Maximum Bitwise OR | Detailed Explanation | Leetcode 2411 | codestorywithMIK
Company Tags : will update later
Code Github(C++ & JAVA) - https://github.com/MAZHARMIK/Interview_DS_Algo/blob/master/Bit_Magic/Smallest Subarrays With Maximum Bitwise OR.cpp
Leetcode Link - https://leetcode.com/problems/smallest-subarrays-with-maximum-bitwise-or/description/
My DP Concepts Playlist : • Roadmap for DP | How to Start DP ? | Topic...
My Graph Concepts Playlist : • Graph Concepts & Qns - 1 : Graph will no m...
My Segment Tree Concepts Playlist : • Segment Tree | Introduction | Basics | Bui...
My Recursion Concepts Playlist : • Introduction | Recursion Concepts And Ques...
Trie Playlist - • Word Search II (Google, Amazon, Meta, Micr...
Difference Array Technique: Concepts & Qns : • Introduction | What | How | Difference Arr...
Monotonic Data Structure Concepts & Qns : • Monotonic Data Structures Concepts & Qns
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Interview_DS_Algo
Instagram : https://www.instagram.com/codestorywithmik/
Facebook : https://www.facebook.com/people/codestorywithmik/100090524295846/
Twitter : https://twitter.com/CSwithMIK
Subscribe to my channel : / @codestorywithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
Video Summary :
The key idea is to compute, for each index, how far we need to go right to include all bits that could contribute to the maximum OR. We track the most recent index where each bit (0 to 30) was last seen set using setIndex. While iterating backward, we update the farthest point (j) we must include to ensure all significant bits are captured. The result at each index is simply the length from i to j. This way, we efficiently find the minimal subarray that gives the max OR at each position.
✨ Timelines✨
00:00 - Introduction
0:16 - Motivation
0:41 - Problem Explanation
4:30 - Thought Process
7:47 - Why do we need to see 32-bit representation ?
21:15 - Core Observation
23:22 - Why iterate from right to left ?
28:42 - Complete Dry Run
40:15 - Coding it up
43:27 - Time & Space Complexity
#MIK #mik #Mik
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #coding #programming #100daysofcode #developers #techjobs #datastructures #algorithms #webdevelopment #softwareengineering #computerscience #pythoncoding #codinglife #coderlife #javascript #datascience #leetcode #leetcodesolutions #leetcodedailychallenge #codinginterview #interviewprep #technicalinterview #interviewtips #interviewquestions #codingchallenges #interviewready #dsa #hindi #india #hindicoding #hindiprogramming #hindiexplanation #hindidevelopers #hinditech #hindilearning #helpajobseeker #jobseekers #jobsearchtips #careergoals #careerdevelopment #jobhunt #jobinterview #github #designthinking #learningtogether #growthmindset #digitalcontent #techcontent #socialmediagrowth #contentcreation #instagramreels #videomarketing #codestorywithmik #codestorywithmick #codestorywithmikc #codestorywitmik #codestorywthmik #codstorywithmik #codestorywihmik #codestorywithmiik #codeistorywithmik #codestorywithmk #codestorywitmick #codestorymik #codestorwithmik