Number of Wonderful Substrings (LeetCode 1915) (Bit Manipulation)

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

CodeWithARB

CodeWithARB

Күн бұрын

Watch at 1.25x or 1.5x
In this Video, I explained the solution for Number of Wonderful Substrings problem. Here, i explain why sliding window will not work and how to think bit manipulation approach for any problem. I also give a gist of how to use XOR properties in this problem and also taking analog to the number of subarray with given sum problem.
Solution and Explaination of Leetcode POTD:
Question: leetcode.com/problems/number-...
Solution: leetcode.com/problems/number-...
0:00 Understanding the Question
2:30 Why Sliding Window does not work ?
5:20 Intution
18:45 Approach
20:20 Implementation
22:35 Time and Space Complexity
#dsa #leetcodemedium #leetcode #array #leetcodepotd #leetcode #leetcodetoday #potd #NumberOfWonderfulSubstrings #leetcodesolutions #LeetCode2997 #bits #bitmanipulation #thinkinbits #bit #dpwithbits @CodeWithARB

Пікірлер: 4
@vaibhavvashist238
@vaibhavvashist238 21 күн бұрын
this mentioned in the editorial can you prove it: The XOR function is equivalent to subtraction under modulo 2. All bits are independently calculated in the XOR function, where for each bit, the output is true when there is an odd number of true inputs.
@CodeWithARB
@CodeWithARB 20 күн бұрын
Yeah right. So, Xor function is equivalent to addition/subtraction under modulo 2. For subtraction, if you try to subtract any two number and see its binary representation that will be equals to Xor operation between them Suppose we subtract 4 from 6. 6+(-4) = 10 6 -> 110 4 -> 100 6^4 = 010 = 2 here modulo 2 is to show that when there are even number of occurences then the result will be always 0 (false) and for odd, it will be 1(true) which is the equivalent to XOR properties.
@srinivasbodduru4263
@srinivasbodduru4263 21 күн бұрын
explanation is bad try better
@CodeWithARB
@CodeWithARB 20 күн бұрын
Sorry for that. The problem was that the original video which i made was not working properly due to some reasons so i made a just go through explaination.
L6. Single Number II | Bit Manipulation
31:19
take U forward
Рет қаралды 13 М.
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 7 МЛН
Когда на улице Маябрь 😈 #марьяна #шортс
00:17
маленький брат прыгает в бассейн
00:15
GL Show Russian
Рет қаралды 4,4 МЛН
О, сосисочки! (Или корейская уличная еда?)
00:32
Кушать Хочу
Рет қаралды 6 МЛН
Leetcode-Number of Wonderful substring
19:41
Coding For Dummies
Рет қаралды 4,4 М.
Number of 1 Bits - Leetcode 191 - Python
11:59
NeetCode
Рет қаралды 110 М.
1915. Number of Wonderful Substrings - Day 30/30 Leetcode April Challenge
23:12
Programming Live with Larry
Рет қаралды 1,6 М.
Number of Subarrays with xor K | Brute - Better - Optimal
24:55
take U forward
Рет қаралды 79 М.
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 7 МЛН