This is just genius, the moment you said to only take the gaps as keys I could figure out the algorithm, things like these helps one to remember the logic behind way quicker. Thanks for the content
Ohh man. I tried my level best for this problem passed 78 test cases, spent over 1.5 hrs on this problem. Got time limit exceeded on 79th case. Came here (my fav TH-camr). Now I am laughing after hearing the logic.
I think this can also be solved with prefix arrays. Whenever the prefix sum at any position of two arrays are the same, that means drawing a line through them at that position will NOT cut through them. So we just have to see at which position, the prefix sum of the MOST number of arrays is the same, and the answer is the remaining bricks (because we will cut through them)
One question: why cannot we set countGap = collections.defaultdict(int)? I guess the reason is defaultdict is only for nonexistent keys not for nonexistent values. Is that correct?
Amazing content / explanation. Would love to see such kind of explanation to the second part of the "Lego Blocks" Hackerrank problem. Only found poor explanations... Anyway, congrats! I'm following the channel now :)
This is just genius, the moment you said to only take the gaps as keys I could figure out the algorithm, things like these helps one to remember the logic behind way quicker. Thanks for the content
I love this explanation, super easy to follow
Feel free to suggest problems below! :~)
Prims and Krushkal's alorithms?
Sliding puzzle
85. Maximal Rectangle
134. Gas Station
I'd like to see more hard leetcode problems
pizza cut
Liked the video before even watching it. The best channel for competitive coding questions. ❤
initial thought: Maximize count the gaps in the wall of bricks - hashpam key is x, value is number of gaps
yet another top notch content from NeetCode!
Ohh man. I tried my level best for this problem passed 78 test cases, spent over 1.5 hrs on this problem. Got time limit exceeded on 79th case. Came here (my fav TH-camr). Now I am laughing after hearing the logic.
I think this can also be solved with prefix arrays. Whenever the prefix sum at any position of two arrays are the same, that means drawing a line through them at that position will NOT cut through them. So we just have to see at which position, the prefix sum of the MOST number of arrays is the same, and the answer is the remaining bricks (because we will cut through them)
i believe this is just a variation of prefix sum
This question made no sense until your video explanation was seen
Excellent explanation bro.
super clear. Thanks
One question: why cannot we set countGap = collections.defaultdict(int)?
I guess the reason is defaultdict is only for nonexistent keys not for nonexistent values. Is that correct?
one of the few qns which i liked
thank you sir
Amazing content / explanation. Would love to see such kind of explanation to the second part of the "Lego Blocks" Hackerrank problem. Only found poor explanations... Anyway, congrats! I'm following the channel now :)
did you find a solution ?
The skyline problem
Sometimes your explanation of problem gives away answer to question - it's too clear. You're taking away our need to practice reaading