Pinned this. Thanks a lot for pointing this out and apologies for the miss from my end ❤️❤️ For more clarification : we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
Sir, I watched 3-4 other videos. But I couldn't understand any of them. After watching your video, I felt like this problem is so easy to understand. Thank you for taking your time in recording this video and teaching new techniques. 🙏🏼
Great as usual....btwn no apologies for not adding that 001 , sometimes in flow one can make mistake and if anybody have paid concentration since begining it wouldnt have been problem for him/her thanks❤
First of all thank you for explaining so clearly, I really appreciate your consistency and hard work. Secondly, can you please explain why we are taking only a to j, and excluding other character. What is the significance of this constraint.
After going through so many videos .. finally understand the solution.... What was the intuition behind Cumulative XOR here ? how you think it can be applied to string question? by seeing problem in start its look like sliding window problem that we have to adjust window according to the wonderful string
subah se iss question ki videos dhk rhi, kisi mai kuch samajh nahi aya. I only follow you channel for DSA. I am really glad ki aapne video ittni zaldi upload kr di, i was waiting. Thankyou sir, thankyou so much.
Thanks for the video. I wanted to ask why are we representing 'a' as 1, 'b' as 10, 'c' as 100, 'd' as 1000, and so on? What if we had taken 'a'= 1, 'b'= 10, 'c'= 11, 'd'= 100 i.e. a is corresponding to bit value of 1, b of 2 and so on?
we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
4:30 Wanted to ask why we didn't take the values of a, b, c, d in the form of integer bit values? like a= 1, b= 10, c= 11, d= 100 instead of a=1, b= 10, c= 100, d= 1000?
I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask) Correct me if I am wrong
how to not take things on mind suppose you are doing job and simulteneosly you're doing this things as well is it ever happend that you don't want to do i think it's totally game of mind so as i ask you how to not take things on mind?
Hi, I am having a bit of confusion, with this problem...at timestamp 29:00 when we do 011 xor 010 we get 001, which is already present in the map which is {001: 1}, so why didn't we consider the substring "ab", also I can understand that since a and b both appear odd number of times i.e. 1, we cannot consider that substring as a wonderful substring but according to the logic of the code, we should, right? I might be wrong here or it is possible that I misunderstood or did not understand the logic clearly, but I'm having a doubt here...hope someone can help me clear it.
we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
Hi Priyanshu, Actually I am currently travelling and hence I stay at different hotels/zostels etc . In order to reduce Some noise, the audio gets a little distorted. Apologies for the inconvenience. Will soon be fixed when I am back home ❤️❤️❤️
Sir I have solved more than 550 problems on leetcode but still not able to solve new problems of medium and hard difficulty, I felt quite sad. Sometimes it seems that I am not intelligent😢😢
class Solution { public: using ll = long long; long long wonderfulSubstrings(string s) { unordered_map mp; ll i = 0 ; ll curr = 0; ll ans = 0; mp[curr]++; ll n = s.size(); while(i
Sir mpp.find() kyu nhi kiya if(mpp.find()) to check hm cumulative sum in sb problems me check krte h ki wo pehle se present to nhi h map me to isme kyu nhi kiya? SIMILAR QUESTIONS ARE # 1542. Find Longest Awesome Substring # 1371. Find the Longest Substring Containing Vowels in Even Counts
I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask) Correct me if I am wrong
at 29:00 001 are present in map but you not count bcoz {b} is also a wonderful string that why answer is 4.....but very nice explaination
Pinned this.
Thanks a lot for pointing this out and apologies for the miss from my end ❤️❤️
For more clarification :
we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
Thanks for this
Even i had the same doubt
thanks bhai
Thanks man
bhai pure youtube pe is question ke solution dekh liye finally found your video what a clear explanation of every concept
Your explanation is the only one which is very clear compared to most other videos on youtube
Sir,
I watched 3-4 other videos. But I couldn't understand any of them. After watching your video, I felt like this problem is so easy to understand.
Thank you for taking your time in recording this video and teaching new techniques. 🙏🏼
beautifully explained everything. even begineers can understand
frankly speaking u are a gem when it comes to break the problem and build on that! you are inspiring lot of enthusiasts out there great Sir.
bhai abhi just 4min pehle dekhra tha koi video cuz bitmask nai ata mko abhi 2min pehle aapne upload krdi thanks man!
maine bola tha dry run ke liye thanks bhiya thanks a lot , sare questions me krwa diya kriye clearity aa jati hai
Thanks for the video will able to understand and implement myself.
Great as usual....btwn no apologies for not adding that 001 , sometimes in flow one can make mistake and if anybody have paid concentration since begining it wouldnt have been problem for him/her thanks❤
This means a lot to me ❤️❤️🙏🙏
yes I was able to figure out that he missed it by mistake. i followed further and understood clearly
Bestest explanation ❤
First of all thank you for explaining so clearly, I really appreciate your consistency and hard work.
Secondly, can you please explain why we are taking only a to j, and excluding other character. What is the significance of this constraint.
It is given in the question that characters ranges from a to j
@@paveshkanungo6338Yes brother I can read the question, but the reasoning behind this constraint is what I want to know.
Very good explanation thanku bhaiya
After going through so many videos .. finally understand the solution.... What was the intuition behind Cumulative XOR here ? how you think it can be applied to string question? by seeing problem in start its look like sliding window problem that we have to adjust window according to the wonderful string
Thank you so much for uploading these types of videos!
Great explanation man , loved it ❤
Bawal parhate ho bhai 🔥🙌
subah se iss question ki videos dhk rhi, kisi mai kuch samajh nahi aya. I only follow you channel for DSA. I am really glad ki aapne video ittni zaldi upload kr di, i was waiting. Thankyou sir, thankyou so much.
❤️❤️❤️
Great Explanation
Thanks for the video. I wanted to ask why are we representing 'a' as 1, 'b' as 10, 'c' as 100, 'd' as 1000, and so on? What if we had taken 'a'= 1, 'b'= 10, 'c'= 11, 'd'= 100 i.e. a is corresponding to bit value of 1, b of 2 and so on?
A very toufff question it was honestly
Thanks bhaiya for such wonderfuk explanation got april potd badge
At 28:59, 001 is already present on the map. Correct it to avoid confusion for other students.
we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
Correct.
See the Pinned Comment.
Sorry to have missed that. ❤️❤️
4:30 Wanted to ask why we didn't take the values of a, b, c, d in the form of integer bit values? like a= 1, b= 10, c= 11, d= 100 instead of a=1, b= 10, c= 100, d= 1000?
@codestorywithMIK how much time you took to solve this problem after reading the problem statement and did you take any help
Bro pls make a playlist on bit manipulation too like DP.😎
Bro it already exists
Good Explaination but this was really tough.. Although I'm bad in Xor stuff this was bouncer
Got april badge alog with you and also because I of you❤🎉😊
At 19:10 - 0101 we have seen in past
Yes. Please refer to the Pinned comment above 😇🙏
20:50 bhaiya,can you mention the questions. I want to practice.
very nicely explaination
this one was quite tough..can we get few more problems on cumulative xor if possible
Best explanation bhai❤
why do we represent characters by powers of 2? why not simple 1,2,3,...?
Sir aapne bataya nhi ki isme sliding window ku nhi lagega please bataye ???
I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask)
Correct me if I am wrong
Crystal clear
how to not take things on mind suppose you are doing job and simulteneosly you're doing this things as well is it ever happend that you don't want to do i think it's totally game of mind so as i ask you how to not take things on mind?
Why not Sliding Window ??
And if we shift 1 to 2 times it become 4 & shift 1 to 3 times it become 16
best explanation bhaiya
❤️❤️
Hi, I am having a bit of confusion, with this problem...at timestamp 29:00 when we do 011 xor 010 we get 001, which is already present in the map which is {001: 1}, so why didn't we consider the substring "ab", also I can understand that since a and b both appear odd number of times i.e. 1, we cannot consider that substring as a wonderful substring but according to the logic of the code, we should, right? I might be wrong here or it is possible that I misunderstood or did not understand the logic clearly, but I'm having a doubt here...hope someone can help me clear it.
Please see the pinned comment ❤️
we have seen 001, so that means that the substring after a, ie only "b" is going to be valid substring in "ab" with 1 odd character. we add 1 to the answer in that step.
Legend 🔥
Bro, what language do you speak?
I am from India 🇮🇳 and speak Hindi
sir aap thooda mic quality increase kr skte toh axa rehta
Hi Priyanshu,
Actually I am currently travelling and hence I stay at different hotels/zostels etc . In order to reduce Some noise, the audio gets a little distorted. Apologies for the inconvenience.
Will soon be fixed when I am back home ❤️❤️❤️
Sir I have solved more than 550 problems on leetcode but still not able to solve new problems of medium and hard difficulty, I felt quite sad. Sometimes it seems that I am not intelligent😢😢
at 28:59 we have seen in past
Yes. Please see the Pinned comment above ❤️❤️
seems hard for those who are newer on bit manipulation.
class Solution {
public:
using ll = long long;
long long wonderfulSubstrings(string s) {
unordered_map mp;
ll i = 0 ;
ll curr = 0;
ll ans = 0;
mp[curr]++;
ll n = s.size();
while(i
Bhai tune yeh code khud likha hai kya
@@hiteshpatwal9688 ha
@@tusharnanda3885 Bhai yrr tujhe acchi knowledge hogi bit masking ki koi channel suggest krrde jo yeh topic acche s krade
@@tusharnanda3885 jhan s tune bhi pda ho
the worst questions are those on strings all of them based on cramming
aaj samjh nhi aaya ek video thora dry run karke ya kuch smjh aye aise banado
❣❣
❤❤
I watched multiple videos bro but this is the only video I understood everything. Leetcode Official explanation is pathetic.
❤
aba ka last me kyun +1 kar dia 😁😁😁😁😁😁
1st
Best explanation😍
Sir mpp.find() kyu nhi kiya if(mpp.find()) to check hm cumulative sum in sb problems me check krte h ki wo pehle se present to nhi h map me to isme kyu nhi kiya?
SIMILAR QUESTIONS ARE # 1542. Find Longest Awesome Substring
# 1371. Find the Longest Substring Containing Vowels in Even Counts
In C++ if an element is not present, it by default returns 0. So i directly accessed it.
But yes, you can add mp.find too
@@codestorywithMIK thankyou sir
Can you please tell why doesnt the sliding window approach work:
class Solution {
public:
long long wonderfulSubstrings(string word) {
unordered_map freq_map;
int noOfOddFreq = 0;
long long ans = 0;
int left=0;
int right =0;
while (left
I think the video explanation is actually a sliding window approach. Instead of cumulative sum or something, are here storing cumulative xor (in the form of bit mask)
Correct me if I am wrong
i want to ask that why we are calcualting the int shift = ch - 'a'; , for this cum_xor ^= (1
❤❤❤❤