Пікірлер
@sydneystriker5355
@sydneystriker5355 Күн бұрын
Great and simple solution.
@RoadToFAANG1992
@RoadToFAANG1992 Күн бұрын
Glad you like it!
@diannic188
@diannic188 3 күн бұрын
Hi, there! Thank you for the explanation, but in the first example nums = [1, 0, 0] and queries = [[0,2]] it's not clear for me why we're not modifying the number zero. Could you please explain this? Thanks a lot!
@dThapa966
@dThapa966 3 күн бұрын
Because at the end, we are looking for our array to be all 0's example - [0,0,0,0] at the end. If you decrement more than 0, you'll get a negative number. So subtracting further after seeing a 0 will ruin the array.
@RoadToFAANG1992
@RoadToFAANG1992 3 күн бұрын
What @dThapa966 said is correct. We want to make all the elements equal 0. For each query, we only need to choose a subset of elements in the range. This means that we can choose not to decrement any elements which are already 0
@DEEPAKDESHMUKH-q2r
@DEEPAKDESHMUKH-q2r 9 күн бұрын
your explanation is best and easy to understand that i can find , please do it regularly for every contest(only 2nd and 3rd question🙂)
@RoadToFAANG1992
@RoadToFAANG1992 9 күн бұрын
Thank you! I’m glad it was helpful and will continue to do as many contests as I can
@moonshine8848
@moonshine8848 9 күн бұрын
isnt finding the length of the keys a 0(N) operation, so the total time complexity is O(Q*N)? shouldnt u have a counter to does it instead??
@CongNguyen-og3iz
@CongNguyen-og3iz 10 күн бұрын
Thanks for the solution! It's really clever
@RoadToFAANG1992
@RoadToFAANG1992 10 күн бұрын
Thank you! I’m glad it was helpful
@ayoni02
@ayoni02 16 күн бұрын
It was helpful, Thanks
@RoadToFAANG1992
@RoadToFAANG1992 16 күн бұрын
No problem! I’m glad it was helpful
@mukulkhanna26
@mukulkhanna26 17 күн бұрын
Thanks a lot for resources and guidance too bruh
@RoadToFAANG1992
@RoadToFAANG1992 17 күн бұрын
Absolutely! I’m glad you found it helpful
@ShariqueAkhtar
@ShariqueAkhtar 22 күн бұрын
so underrated channel.. the explanation is top notch
@RoadToFAANG1992
@RoadToFAANG1992 22 күн бұрын
Thank you! I really appreciate it
@DEEPAKDESHMUKH-q2r
@DEEPAKDESHMUKH-q2r 22 күн бұрын
nice explanation
@RoadToFAANG1992
@RoadToFAANG1992 22 күн бұрын
Thanks! I’m glad it was helpful!
@myko_chxn
@myko_chxn 27 күн бұрын
amazing solution. which category would this problem fall under? math?
@RoadToFAANG1992
@RoadToFAANG1992 27 күн бұрын
Thank you! Yea I think this would be considered to be a math/geometry problem.
@sierr1302
@sierr1302 Ай бұрын
Great stuff. Failed an interview recently I wasn’t ready. Back to the books.
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
It happens to all of us. The only way we can truly fail is if we stop trying so take a small break and get back to the grind
@robindey4273
@robindey4273 Ай бұрын
A great and smooth explanation❤ Thanks
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
Glad it helped!
@rsKayiira
@rsKayiira Ай бұрын
Quick question how accurate are the scores attached to contest questions when gauging difficulty? they range from 1-11 but usually questions asked in contests have a rating of between 3-7
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
I think they are a pretty good indicator of the general difficulty but they are not exact. For example, if I see an 8 I’m pretty sure it’s going to be a very hard problem. On the other hand a 5 I sometimes find pretty easy or quite hard. It’s a good general guide but not exact.
@rsKayiira
@rsKayiira Ай бұрын
@@RoadToFAANG1992 I see got it. Thank you.
@rsKayiira
@rsKayiira Ай бұрын
@@RoadToFAANG1992 okay thank you so much. Btw how accurate is zerotrac? If I did say all 1200-1300, 1300-1400 level problems and understood them, could I expect to be able to do qn 1 consistently in contests. My target right now is to be able to do Qn 1 and 2 consistently. Seems for Qn 1 you need to be good with 1100-1400 level problems and for Qn 2 you need to be good with 1400-1800 level problems
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
I would say it depends on the contest. Recently the contests have become extremely hard to try and stop people from cheating using ChatGPT. If you can get to 1800 I would say for most contests you would be able to solve 3 questions but maybe only 2 in more recent contests. Q1 is usually very easy so as long as you are confident in your DSA I think Q1 should be fine. However in some recent contests Q1 have been medium even though they are a bit on the easier side
@rsKayiira
@rsKayiira Ай бұрын
@@RoadToFAANG1992 I see!! Damn they are making them more difficult. Thanks for the feedback. I’m trying to do all weekly between 1200-1400 since my rating is at 1250 despite doing 900 LC. Basically starting over. My target is to hit 1700 or at most 1800 by next year
@aadityatripathi8363
@aadityatripathi8363 Ай бұрын
great video. Thanks for introducing zerotrac to me
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
Of course! It’s a great resource hopefully it’s helpful for you
@rsKayiira
@rsKayiira Ай бұрын
Congratulations, great video and honest video. Thank you
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
Thank you! I’m glad this video was helpful for you
@riyanshbiswas
@riyanshbiswas Ай бұрын
BEST explanation that i found for this question. Thank you! It was a nightmare just to understand it.
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
Perfect! I’m glad I can help
@night5722
@night5722 Ай бұрын
Thank you for content, I always use it to reflect & learn post contest.
@RoadToFAANG1992
@RoadToFAANG1992 Ай бұрын
Glad the content is helpful for you! I will keep creating it but also let me know what types of content would help you more!
@sierr1302
@sierr1302 2 ай бұрын
Wonderful video. Investing in at 81 subs. You deserve more. Keep goin brotha!
@RoadToFAANG1992
@RoadToFAANG1992 2 ай бұрын
Thanks! Glad you’re liking the content!
@yashmundada2483
@yashmundada2483 2 ай бұрын
Nicely done
@RoadToFAANG1992
@RoadToFAANG1992 2 ай бұрын
Thanks!
@shan_singh
@shan_singh 2 ай бұрын
finally an explanation that i can easily understand, well put together, precise. Thank you
@RoadToFAANG1992
@RoadToFAANG1992 2 ай бұрын
Glad it was helpful!
@amarkoni9481
@amarkoni9481 3 ай бұрын
this was pretty good mate, cheers
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
Glad you enjoyed it!
@johnlocke4695
@johnlocke4695 3 ай бұрын
Great videos! Your explanation is short and concise. Please don't stop making such amazing videos.
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
Glad you like them!
@johnlocke4695
@johnlocke4695 3 ай бұрын
I wasted an hour because I couldn't understand the question in the contest.
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
The description was definitely unclear. Leetcode really needs to to better with these contests
@jordanshand7393
@jordanshand7393 3 ай бұрын
Great job breaking the problem down and coherently explaining your logic step by step.
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
Glad it was helpful!
@shivansh-gup
@shivansh-gup 3 ай бұрын
Thanks this solution is understandable. I will need more practice to come up with it in contest itself.
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
Me too. I was not able to get it in the contest. We just need to keep grinding and we will get there
@monstrnub8616
@monstrnub8616 3 ай бұрын
Hey how did you manage to pass the last testcase, I am getting TLE with your same code, i got it from your profile on leetcode so its same. It fails on last test case.
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
That’s weird. Let me try to run it again. Maybe they tightened the constraints since after the contest
@monstrnub8616
@monstrnub8616 3 ай бұрын
@@RoadToFAANG1992 let me know did it pass for you or not
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
The original solution is getting a TLE but if on line 18 you change it to `for count, x in pairs[:100]:` it will work. In this case we only go through the first 100 possible x values
@monstrnub8616
@monstrnub8616 3 ай бұрын
It would be better if you could give a link to your code, try to have your leetcode screen at 150% or more as its hard to read from small characters. Everything else is fine
@RoadToFAANG1992
@RoadToFAANG1992 3 ай бұрын
That’s a great idea. Will definitely do that in future videos
@gavinebenezer1670
@gavinebenezer1670 4 ай бұрын
Good way of explaining
@RoadToFAANG1992
@RoadToFAANG1992 4 ай бұрын
Thanks! I’m glad it was helpful
@sparrow243
@sparrow243 4 ай бұрын
I sub y thanks for such a great content
@RoadToFAANG1992
@RoadToFAANG1992 4 ай бұрын
Thanks you for subscribing! I’m glad you are enjoying the content
@abdifatahmoh
@abdifatahmoh 4 ай бұрын
This is a good explanation. Thank you for that but instead of using an indices array, you could use a dictionary for constant look-up. something like this: occurrences = {} for i in range(len(nums)): if nums[i] == x: if x in occurrences: occurrences[x].append(i) else: occurrences[x] = [i]
@RoadToFAANG1992
@RoadToFAANG1992 4 ай бұрын
Thanks for the comment! Yes we could definitely do it this way with a hashmap as well. Using the array should still be a constant look up however, since we are just getting a specific index in the array and not traversing through the whole thing each time.
@jubiliudu
@jubiliudu 5 ай бұрын
Great! Best solution, thanks!!
@RoadToFAANG1992
@RoadToFAANG1992 5 ай бұрын
Glad it was helpful!
@rajan-u6b
@rajan-u6b 6 ай бұрын
thanks man, nice
@RoadToFAANG1992
@RoadToFAANG1992 6 ай бұрын
No problem!
@IOSALive
@IOSALive 7 ай бұрын
Road To FAANG, You're amazing! Let's be friends and hang out!
@RoadToFAANG1992
@RoadToFAANG1992 7 ай бұрын
Glad you’re enjoying the content!