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

  Рет қаралды 1,284

codingMohan

codingMohan

Күн бұрын

Пікірлер
@skskksksSkskksks
@skskksksSkskksks 7 ай бұрын
how are u sure that the AND arrays generated are decreasing in nature?
@skskksksSkskksks
@skskksksSkskksks 7 ай бұрын
nvm i understood; bits might or might not get unset as more numbers are iterated so it's decreasing
@codingmohan
@codingmohan 7 ай бұрын
Yeah I realised that I forgot to explain that part. Glad that you asked. The AND of 2 numbers is always smaller than (or equal to) both the individual numbers. Why? - If a bit is set in any one of the number, the bit can be set in AND if and only if both the numbers have that particular but set. I.e. if a bit is set in AND, it means it is set in both numbers and if it is unset in AND, it means that numbers might have it set or unset. Hence AND is always smaller than both the numbers. Further, if you keep ANDing more numbers, the value can only decrease because once a bit is unset in AND, you can't set it back with any number. Hope it clarifies. Feel free to ask any follow up questions.
@Truysジャ
@Truysジャ 7 ай бұрын
​@@codingmohan if that is the case in 17:44 in the upper bound function. Don't you think the condition l = m+1 and r = m, should be vice versa.
@Cools74
@Cools74 7 ай бұрын
15:10 There is slight mistake in pseudo code If(and[ start.... m]
@codingmohan
@codingmohan 7 ай бұрын
Nice catch.
@AnandKumar-kz3ls
@AnandKumar-kz3ls 7 ай бұрын
was able to solve all 4 question by my own thanks mohan please don't stop making videos
@yatri6329
@yatri6329 7 ай бұрын
Bhagwan h Bhai tum 700+ Q kar liya Leetcode p but Aaj Tak kbhi 2 se jyda Q nhi kar paya contest m
@MrSaint-ch6xn
@MrSaint-ch6xn 6 ай бұрын
​@@yatri6329 ha bhai mene bhi abhi 500 + kiye hai but 3rd pe hi hug deta hu
@yatri6329
@yatri6329 6 ай бұрын
@@MrSaint-ch6xn dimag tej nhi h mera nothing else
@Cools74
@Cools74 7 ай бұрын
Thank you man for various approaches 🤗
@souravshaw8904
@souravshaw8904 7 ай бұрын
Awesome explanation❤
@MrSaint-ch6xn
@MrSaint-ch6xn 6 ай бұрын
The question is now changed from AND to OR
@ravenarc3652
@ravenarc3652 7 ай бұрын
Review vutrubac's solution for once. Good video btw, really helpful 🙏🏻
@L_Yassine
@L_Yassine 7 ай бұрын
thanks sir
@gui-codes
@gui-codes 7 ай бұрын
it's too complex man.
@codingmohan
@codingmohan 7 ай бұрын
Which of the 2 solutions you found difficult? And if you can help understand which part is exactly not clear, maybe I could help.
@rohitsinha3519
@rohitsinha3519 7 ай бұрын
@codingmohan He is probably talking about 2nd approach. At the end you said there are problems where find logN values are better than building array, can you comment out such questions example?
@darshanrajpattanaik2154
@darshanrajpattanaik2154 7 ай бұрын
​@@rohitsinha3519 He's wrong there, building the array is optimal approach
@iWontFakeIt
@iWontFakeIt 7 ай бұрын
contest me ye solve hogya aj! aj alag hi confidence level h! ye and function monotonic wala approach bhaiya aap ne pehle ek video me bhi sikhaya tha isliye dimag me chamak gya :) 🫡
@iWontFakeIt
@iWontFakeIt 7 ай бұрын
your approach 2 is amazing; learnt something new again
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН
3251. Find the Count of Monotonic Pairs II | Weekly Leetcode 410
33:04
3276. Select Cells in Grid With Maximum Score | Weekly Leetcode 413
36:39
7 Outside The Box Puzzles
12:16
MindYourDecisions
Рет қаралды 87 М.
3123. Find Edges in Shortest Paths | Weekly Leetcode 394
44:06
3219. Minimum Cost for Cutting Cake II | Weekly Leetcode 406
1:03:26
Merge Sorted Arrays Without Extra Space | 2 Optimal Solution
32:47
take U forward
Рет қаралды 234 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 158 МЛН