Simple and effective explanation and solution. Thanks!
@sasi.connect9 күн бұрын
In line 12, what is the intuition behind "max(dist) * 100" ?
@sahebraojadhav97279 күн бұрын
Keep going🔥🔥
@pratiksalvi490110 күн бұрын
I really enjoyed this format. Easier to understand the thought process behind the solution.
@zaeemashfaq471711 күн бұрын
Nice solution!
@vineethm693011 күн бұрын
Awesome explanation !!
@yingxu169414 күн бұрын
好聪明
@baophi232218 күн бұрын
hey! Thank you for the video. But what's the intuition behind this? Is that just because you made up a large table and see the behavior that when index is 0 we fill nothing inside, when index is 1 you fill one 1 in and index is 2 you fill two 1s in and then you conclude that we have to fill n-1 1 into that given x? I really appreciate your response! Thank you
@Alpha-Code18 күн бұрын
Hey, yeah no problem. Intuition is two parts. 1. Every number has to have the bits in x set to one. 2. the slowest way to grow a number is to add one to it. Then from there you realize that we just grow the bits that are available from the smallest number possible (0) to n-1 since we are adding one every time. But since we just need the last number we can just get those bits for n-1 and place them in empty slots which will give us the answer.
@zweitekonto965420 күн бұрын
Tricky problem, took me a while to figure out.
@zweitekonto965420 күн бұрын
Tricky problem, took me a while to figure out.
@zweitekonto965422 күн бұрын
What's up with that thumbnail 💀
@Alpha-Code22 күн бұрын
that better lol? other image i had was wrong dimensions so got stretched out.
@B-Billy29 күн бұрын
So explanation is awesome!!! Thanks, Subscribed!
@sasi.connectАй бұрын
After checking many videos, I found this one to be the best for this problem. Thanks for the detailed explanation
@dregun7057Ай бұрын
Why'd you stop? I used to watch your explanations daily even if I solved the questions myself. I found your solutions and their way of explaining to be very helpful. Please continue if you can... Thanks!
@Alpha-CodeАй бұрын
Yeah, been busy last few weeks. Should get back to it starting next week most likely.
@AntinormanistoАй бұрын
The only reason why I'm here is not knowing what minimum absolute difference is
@3227998Ай бұрын
Thanks a lot! Great explanation. A general question: for someone struggling with questions involving operations with many indicies, do you there is a specific foundation that needs to be learned or it is matter of practicing and increasing one's working memory capacity? I am asking, because questions like this make me feel like trying to juggle many things simultaneously and getting confused with all the "moving parts"
@noaht9184Ай бұрын
Perfectly explained video, holy, thank you very much.
@em8136Ай бұрын
this explanation is so good
@vivek.tiwaryАй бұрын
Nice explanation, thanks
@bendakaya9912Ай бұрын
Thanks for the logic!
@PoRBvGАй бұрын
when we flip the mask, do that mean we remove that character from the mask? how does it work? if we remove from it, then we break the substring to two substrings
@talwaarkidhaarАй бұрын
Awesome explanation... Especially, The part where, "Just after explaining the equations, you also take an example to illustrate it, instead of just messing around with variables." Thanks...
@qqw112Ай бұрын
thanks for discussing all the possible solutions. it helps to see the problems from different sides.
@alifrahman7099Ай бұрын
goated
@anoops7974Ай бұрын
Thank youu
@asgarantonyАй бұрын
The solution is straightforward, but I could never have come up with it myself.😢
@maniBraveАй бұрын
nice explanation
@arthurtancrediАй бұрын
Very good explanation. I was having a hard time understanding the prefix sum thing, thank you. I love that you use Excalidraw, it makes it very beautiful and readable. One note: mod still works fine for negative numbers. k mod p = k + n*p mod p, so adding or subtracting p is essentially the same as adding 0.
@Alpha-CodeАй бұрын
I think this is language dependent, could be wrong. Mod of negative numbers gives different results in different languages I think.
@zweitekonto9654Ай бұрын
Mod works fine. The language does not.
@arthurtancrediАй бұрын
Probably not works in Java then, I tested in Python and it works fine. But nice to know that I should be careful with that.
@Alpha-CodeАй бұрын
@@arthurtancredi python negative mods work fine
@tamannasingh5672Ай бұрын
Explained this code very well
@vinyasbharadwaj5630Ай бұрын
loved the explanation 👍
@samrit9992Ай бұрын
awesome video :)
@eerav_koiralaАй бұрын
thanks dude
@tomiczdarkoАй бұрын
Way better solution than neetcode!
@asgarantony2 ай бұрын
the solution is amazing , you are doing a great job . I am following you for a while.🙌
@Alpha-Code2 ай бұрын
thx, glad to hear it.
@zweitekonto96542 ай бұрын
dude voice too low.
@-Alexey-2 ай бұрын
Thank you, this is very clever implementation. PS Using the Integer[] cache will result in an impressive 6ms execution time.
@M0h1tKum4r2 ай бұрын
Great explanation man 👌, Loved it!
@jabedhasan212 ай бұрын
This is the best and most cleaned and well-explained, Thank you so much for the excellent content. Subscribed
@crekso3982 ай бұрын
it was really impressive solution
@hagverdiibrahimli85612 ай бұрын
The dedication is impressive. Keep up the good work.
@ShubhamSharma-sf8wk2 ай бұрын
Great explanation
@asgarantony2 ай бұрын
doing a great job man , helping a. noobie like me .
@kristiyangerasimov67082 ай бұрын
Subscribed. This is brutal! I can barely understand and follow the algorithm, even with chatgpt, the solution and a video explanation I'm still having difficulties understanding how to apply this approach to another problem like counting all occurrences of lowercase characters (a-z) in a given string. Masking is extremely powerful and is a must-have tool, so thank you for the video!
@beeam17912 ай бұрын
Man, you rock! Thanks for all you're doing!
@KK-pz6xn2 ай бұрын
nice solution!
@noaht91842 ай бұрын
Thank you, you are a legend.
@SmoggyOwO2 ай бұрын
Can you explain contest questions aswell?
@Alpha-Code2 ай бұрын
Gonna take a break from doing videos for those and easy problems I think. Easies don't really need a video and contests is just too many weekly problems with the work I currently have.
@SmoggyOwO2 ай бұрын
@@Alpha-Code i see nevertheless i appreciate your consistency in uploading the videos everyday for free
@SmoggyOwO2 ай бұрын
I just realised, you use Ai to generate your thumbnails right?
@Alpha-Code2 ай бұрын
yes
@BlackLightning732 ай бұрын
I had an interesting problem where I accidentally derived this algorithm. The question was to place each number of an input array into one of 2 arrays as you go, depending on which of the 2 arrays had more elements strictly greater than the current number at the time. I tracked a sorted version of each array, comparing the bisect.bisect_right index relative to the size of the array to get the strictly greater than count and then using bisect.insort to insert into the appropriate sorted array. The funny thing is I did that recently and didn't see the application it had to this problem haha