He checks if character arr[R](as a key) exists in the map and returns the number of its repetitions, or 0 if it doesn't.So when hm.put is executed it either puts the key arr[R] for the first time with 1 as the number of its repetitions, or incremented value of the previous number of repetitions.
Nice! Other solutions feel like magic, when they update the left pointer to the least recently seen element
so much simplified explanation. thanks!
Thanks a lot for the clear and calm explanation, I complete misunderstood it.
Glad it helped!
🐱👤Wow! this is actually a premium question on leetcode. Thank you for sharing your knowledge! 👏
My pleasure!
Nice this one was a little confusing so i gotta restudy it
Practice makes perfect and there are a couple more videos that are similar to this, so worth trying as well
@@EricProgramming thx i learned it after going thru it a couple times
Sir nice explanation 🙏🙏
Thanks for liking
Good video. What's the time and space complexity of the solution?
thank you very much❤
Thank you!
can someone explain the second part of the HashMap...why inside of the hm.put its hm.getOrDefault(arr[R], 0) + 1), like what is that saying exactly?
He checks if character arr[R](as a key) exists in the map and returns the number of its repetitions, or 0 if it doesn't.So when hm.put is executed it either puts the key arr[R] for the first time with 1 as the number of its repetitions, or incremented value of the previous number of repetitions.
If we know that K is two why can't we just do hm. remove(arr[L]) ? Instead of decrementing it first?
for this example what python libraries in basics we have to study...and is this kind of examples are asked in FAANG interviews?
huhh??