Leetcode 1215. Stepping Numbers (bfs)
11:55
Пікірлер
@guedjs
@guedjs 5 күн бұрын
it may have been easier to understand by keeping the/one example
@letscode1000
@letscode1000 5 күн бұрын
yes, it makes sense to keep consistant with examples, I'll keep in mind.
@shashwatbhatnagar659
@shashwatbhatnagar659 5 күн бұрын
Great explanation. Thank you so much. Keep this great work up !! 🥰
@letscode1000
@letscode1000 5 күн бұрын
thanks😃
@basic-2-advance
@basic-2-advance 6 күн бұрын
Keep up the good work!
@sallaklamhayyen9876
@sallaklamhayyen9876 8 күн бұрын
good explanation = thank you so much + please continue❤❤
@letscode1000
@letscode1000 8 күн бұрын
thanks, every time when I start to give up and received the message that cheer me up to continue.❤
@Dagemawi-j7i
@Dagemawi-j7i 18 күн бұрын
Thanks a lot this was helpful👍👍
@cidu1706
@cidu1706 21 күн бұрын
给我讲懂了,太强了
@letscode1000
@letscode1000 22 күн бұрын
What is your intution when you come across this problem?
@problemsolvers7085
@problemsolvers7085 25 күн бұрын
Hi, I love your content! 🎥 I specialize in video editing and thumbnail design, and I’d love to help enhance your videos and boost your channel's visuals. If you’re interested, let’s chat about how I can contribute to your amazing work!
@letscode1000
@letscode1000 24 күн бұрын
thanks a lot, I still need more time to focus on how to improve my English skills and algorithms skills. Boosting the channel is not my target currently.
@problemsolvers7085
@problemsolvers7085 24 күн бұрын
@@letscode1000 Thank you for your time and consideration. I completely understand and appreciate your response. If you ever have a need for video editing or thumbnail design services in the future, please don’t hesitate to reach out. Wishing you continued success with your channel! Best regards,
@karvinus
@karvinus Ай бұрын
very easy and intuitive solution
@letscode1000
@letscode1000 27 күн бұрын
thanks mate
@ronaldjohnson_ita
@ronaldjohnson_ita Ай бұрын
Thanks!
@letscode1000
@letscode1000 27 күн бұрын
No problem!
@Anonymous____________A721
@Anonymous____________A721 Ай бұрын
Nice reading comprehension
@letscode1000
@letscode1000 27 күн бұрын
Thank you!
@Anonymous____________A721
@Anonymous____________A721 27 күн бұрын
@@letscode1000 😑😑
@aqhr050
@aqhr050 Ай бұрын
Thanks for the solution, this would be very hard without sortedlist.
@letscode1000
@letscode1000 27 күн бұрын
definitely
@rajushankpoul9928
@rajushankpoul9928 Ай бұрын
Hey buddy I have no idea about this but Im still watching..!
@letscode1000
@letscode1000 Ай бұрын
I know it seems hard when you first come across linked list, but it will be much easier when you’re getting familiar with basic data structure like tree and graph, linked list is basic disconnect and connected 2 nodes, from beginning you can practice with making a drawing, after that,everything is in your mind, you know how to do it.
@rajushankpoul9928
@rajushankpoul9928 Ай бұрын
@@letscode1000 Everything in my mind, So how can I access my brain info..!
@rajushankpoul9928
@rajushankpoul9928 Ай бұрын
If everything in my mind, so how can I access my brain info.. !
@letscode1000
@letscode1000 Ай бұрын
@@rajushankpoul9928 this is not the kind of hard problems need to use brain, only some harder problems need to use brain, use your mind is like memory and experience.
@rajushankpoul9928
@rajushankpoul9928 Ай бұрын
@@letscode1000 hey buddy how can I send video to better understanding for me..!
@HarisVFX
@HarisVFX Ай бұрын
This was helpful thanks!
@letscode1000
@letscode1000 27 күн бұрын
thanks
@unanimous8510
@unanimous8510 Ай бұрын
why do you draw that grid's border as a semi-circle? that should be a straight line god damn it!
@letscode1000
@letscode1000 Ай бұрын
this is a 4 color problem
@madhuvamsimachavarapu5267
@madhuvamsimachavarapu5267 Ай бұрын
class Solution: def findTheDistanceValue(self, arr1: List[int], arr2: List[int], d: int) -> int: myset = set(arr2) count = 0 def process(i,d): ans = [i] while d>=0: ans.extend([i-d,i+d]) d-=1 return ans for i in arr1: acceptable_values=process(i,d) ll=list(filter(lambda x:x in myset,acceptable_values)) if len(ll)>=1: continue else: count+=1 return count
@МаркЛевичкин
@МаркЛевичкин Ай бұрын
Elegant
@letscode1000
@letscode1000 2 ай бұрын
we can use return list(A.intersection(P)) to make it mush easier to write
@ceciljoel9577
@ceciljoel9577 2 ай бұрын
If someone is good at codeforces problems can they easily become good at leetcode problems
@PigCurious
@PigCurious 2 ай бұрын
Thanks for the video, helped me out. keep up the good work! 🌸
@letscode1000
@letscode1000 Ай бұрын
Thank you! Will do!
@supplymeweed
@supplymeweed 2 ай бұрын
I have a doubt why we cannot make prefix sum of size same as nums size, why we initialize prefix sum 0 at 0 index
@letscode1000
@letscode1000 2 ай бұрын
It's also ok without zero padding, we can prepare a padding 0 for easy handle edge cases, like prefix sum from index 2 - index 0, if no zero padding, you need to have the edge cases check and add more lines of code. if it has no index 0 padding, you need the if check to check if it is zero.
@supplymeweed
@supplymeweed 2 ай бұрын
Thank you bro, this solution really helped me...
@yashwanthnadella537
@yashwanthnadella537 3 ай бұрын
Nice explanation!
@nikenuke
@nikenuke 3 ай бұрын
thank you!
@sherzodaxadov5939
@sherzodaxadov5939 3 ай бұрын
good idea bro thanks
@letscode1000
@letscode1000 Ай бұрын
No problem
@lnaffable
@lnaffable 3 ай бұрын
thanks broo
@Pavan_Guru_2803
@Pavan_Guru_2803 4 ай бұрын
Nyc Explaination Bro
@letscode1000
@letscode1000 4 ай бұрын
Thanks
@sallaklamhayyen9876
@sallaklamhayyen9876 4 ай бұрын
good explanation = thank you so much❤❤❤ please keep doing this kind of videos , because are very helpful for us
@letscode1000
@letscode1000 4 ай бұрын
thanks, I'll continue to improve the content and quality of the video.
@elliekong712
@elliekong712 4 ай бұрын
Thanks a lot!!!!! <3
@khushibhansali5786
@khushibhansali5786 4 ай бұрын
code does work when hamsters =".HH.H.H.H.."
@letscode1000
@letscode1000 4 ай бұрын
tested, works class Solution: def minimumBuckets(self, hamsters: str) -> int: n = len(hamsters) i, res = 0, 0 while i < n: if hamsters[i] == 'H': if i + 1 < n and hamsters[i + 1] == '.': i += 2 res += 1 elif i - 1 >= 0 and hamsters[i - 1] == '.': res += 1 else: return -1 i += 1 return res
@phillipduffy9489
@phillipduffy9489 4 ай бұрын
promo sm
@JinhuaXiong
@JinhuaXiong 5 ай бұрын
Thank you so much for the video! It really helped me learn sliding window, such a smart way to solve it, the logic behind it is quite tricky though.
@ramrockzz8773
@ramrockzz8773 5 ай бұрын
Nice Explanation
@riddle-me-ruben
@riddle-me-ruben 5 ай бұрын
Great solution and easy to understand thanks for the whiteboard explanation.
@letscode1000
@letscode1000 4 ай бұрын
Glad it was helpful!
@hardiklimbachiya9046
@hardiklimbachiya9046 5 ай бұрын
So far. easiest explanation found on youtube ..Thanks !
@xBlackMambaWT
@xBlackMambaWT 5 ай бұрын
great solution and explanation!
@letscode1000
@letscode1000 5 ай бұрын
Glad it helped!
@whatshouldbethename4522
@whatshouldbethename4522 6 ай бұрын
Can we use vanilla dijkstra instead?
@letscode1000
@letscode1000 5 ай бұрын
yes, we can.
@sayeedchowdhury11
@sayeedchowdhury11 6 ай бұрын
Thanks, good explanation
@letscode1000
@letscode1000 4 ай бұрын
Glad it was helpful!
@ЕвгенийПросвирнин-и4б
@ЕвгенийПросвирнин-и4б 6 ай бұрын
it is not binary search solution((
@letscode1000
@letscode1000 4 ай бұрын
hmm, maybe recursive or quick power is a good name
@tarushiarora8628
@tarushiarora8628 6 ай бұрын
Explained it in precise and concise manner ..amazing
@dhmkkk
@dhmkkk 6 ай бұрын
your channel is a goldmine got my weekends covered now🙏
@letscode1000
@letscode1000 6 ай бұрын
Thanks, I’ll continued the improvement, practice makes perfect!
@Anurag-gi2li
@Anurag-gi2li 6 ай бұрын
Thanks
@letscode1000
@letscode1000 6 ай бұрын
The time complexity is O(n^4), sorry for that I didn't solve it online, after carefully checking, it should be this: we have s1, s2 with cache, it's n^2, we have for loop, it's now n^3, but we also have s1 == s2, it's another O(n), so the time complexity is O(n^4), if you have any questions, please make a comment.
@rajan-u6b
@rajan-u6b 7 ай бұрын
awesome bro.....thankx
@letscode1000
@letscode1000 7 ай бұрын
time is O(m + n)
@letscode1000
@letscode1000 7 ай бұрын
Time is O(n^2), there is for loop inside.
@vinayakbajpeyi931
@vinayakbajpeyi931 7 ай бұрын
Cool video, thanks!
@letscode1000
@letscode1000 4 ай бұрын
Glad you liked it!
@szain98
@szain98 7 ай бұрын
I think they have added new test cases to this problem, this solution gives TLE now. But my intuition is that you can actually abstract the inner for-loop into its own method (example: def parseSubstring(...){}. If the for-loop in this new method is somehow transformed into a recursive call, then you can add @cache decorator above the new parseSubstring(...) method signature to memoize the results and prevent TLE. I'm too lazy to spend time implementing this though since I'd rather use my time to review other problems for my Amazon on-site lol.....
@letscode1000
@letscode1000 7 ай бұрын
I've justed checked in .com and .cn, they're both ok in python. here is the code, you can have check. class Solution: def longestValidSubstring(self, word: str, forbidden: List[str]) -> int: forbidden = set(forbidden) # n * m ** 2 l, res = 0, 0 for r in range(len(word)): for i in range(r, max(r - 10, l - 1), -1): if word[i: r + 1] in forbidden: l = i + 1 break res = max(res, r - l + 1) return res
@szain98
@szain98 7 ай бұрын
This really helped me understand this problem better, thanks