![Algorithms Casts](/img/default-banner.jpg)
- 671
- 385 068
Algorithms Casts
United States
Registrace 19. 11. 2017
Algorithms casts is a channel dedicated to screencasts teaching algorithms and data structures
Leetcode 1701: Average Waiting Time
#leetcodechallenge #coding #algorithms
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts
🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice
Problem: leetcode.com/problems/average-waiting-time/description/
#leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview
⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATIONS: czcams.com/video/m0J1Q2EbvOc/video.html
⭐ ⭐ ⭐ HARD LEETCODE PROBLEMS EXPLANATIONS: czcams.com/video/EzDnB7Ayv08/video.html
▬▬▬▬▬▬▬▬▬▬▬▬
leetcode weekly contest, weekly contest, leetcode, google coding interview, Leetcode 1701, leetcode 1701, Leetcode 1701: Average Waiting Time,
Leetcode 1701. Average Waiting Time, Average Waiting Time, biweekly contest, weekly contest, daily leetcode challenge, neetcode, neetcodeio, larry, bit manipulation, binary, xor operation, breadth first search, bfs, recursion, mathtwo pointers, string, binary manipulation, bit manipulation, binary, recursion, dynamic programming, kmp, prefix, string, prefix, suffix, brute force, matrix,geometry, brute force, prefix sum, hashmap brute force, sliding window, mean heap, geapq,
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts
🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice
Problem: leetcode.com/problems/average-waiting-time/description/
#leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview
⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATIONS: czcams.com/video/m0J1Q2EbvOc/video.html
⭐ ⭐ ⭐ HARD LEETCODE PROBLEMS EXPLANATIONS: czcams.com/video/EzDnB7Ayv08/video.html
▬▬▬▬▬▬▬▬▬▬▬▬
leetcode weekly contest, weekly contest, leetcode, google coding interview, Leetcode 1701, leetcode 1701, Leetcode 1701: Average Waiting Time,
Leetcode 1701. Average Waiting Time, Average Waiting Time, biweekly contest, weekly contest, daily leetcode challenge, neetcode, neetcodeio, larry, bit manipulation, binary, xor operation, breadth first search, bfs, recursion, mathtwo pointers, string, binary manipulation, bit manipulation, binary, recursion, dynamic programming, kmp, prefix, string, prefix, suffix, brute force, matrix,geometry, brute force, prefix sum, hashmap brute force, sliding window, mean heap, geapq,
zhlédnutí: 12
Video
Leetcode 1823: Find the Winner of the Circular Game
zhlédnutí 32Před 2 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/find-the-winner-of-the-circular-game/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview ...
Leetcode 3208: Alternating Groups II
zhlédnutí 26Před 4 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/alternating-groups-ii/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleintervie...
Leetcode 3212. Count Submatrices With Equal Frequency of X and Y
zhlédnutí 58Před 4 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/count-submatrices-with-equal-frequency-of-x-and-y/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #cod...
Leetcode 3211: Generate Binary Strings Without Adjacent Zeros
zhlédnutí 76Před 4 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/generate-binary-strings-without-adjacent-zeros/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #coding...
Leetcode 1518: Water Bottles
zhlédnutí 111Před 4 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/water-bottles/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ ME...
Leetcode 3207: Maximum Points After Enemy Battles
zhlédnutí 54Před 7 hodinami
#leetcodechallenge #coding #algorithms 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/maximum-points-after-enemy-battles/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #g...
Leetcode 3206 Alternating Groups I
zhlédnutí 39Před 7 hodinami
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/alternating-groups-i/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATI...
Leetcode 2582: Pass the Pillow
zhlédnutí 143Před 7 hodinami
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/pass-the-pillow/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATIONS: ...
Leetcode 2058: Find the Minimum and Maximum Number of Nodes Between Critical Points
zhlédnutí 41Před 9 hodinami
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/find-the-minimum-and-maximum-number-of-nodes-between-critical-points/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #google...
Leetcode 2037: Minimum Number of Moves to Seat Everyone
zhlédnutí 90Před 21 dnem
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCOD...
Leetcode 75: Sort Colors
zhlédnutí 60Před 21 dnem
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/sort-colors/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATIONS: czca...
Leetcode 3180: Maximum Total Reward Using Operations I
zhlédnutí 132Před 28 dny
This week's leetcode weekly contest: Weekly Contest 401 🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/maximum-total-reward-using-operations-i/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorit...
Leetcode 1122: Relative Sort Array
zhlédnutí 50Před 28 dny
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/relative-sort-array/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCODE PROBLEMS EXPLANATIO...
Leetcode 3179: Find the N-th Value After K Seconds
zhlédnutí 94Před 28 dny
🥷 1:1 coding interviews and leetcode problems coaching, Book a session with me on Superpeer: superpeer.com/algorithmscasts 🐮 Support the channel on Patreon: www.patreon.com/algorithmspractice Problem: leetcode.com/problems/find-the-n-th-value-after-k-seconds/description/ #leetcode #python #leetcodedailychallenge #leetcodedaily #algorithm #codinginterview #googleinterview ⭐ ⭐ MEDUIM LEETCODE PRO...
Leetcode 3178: Find the Child Who Has the Ball After K Seconds
zhlédnutí 84Před 28 dny
Leetcode 3178: Find the Child Who Has the Ball After K Seconds
Leetcode 2441: Largest Positive Integer That Exists With Its Negative
zhlédnutí 128Před 2 měsíci
Leetcode 2441: Largest Positive Integer That Exists With Its Negative
Leetcode 988: Smallest String Starting From Leaf
zhlédnutí 62Před 2 měsíci
Leetcode 988: Smallest String Starting From Leaf
Leetcode 129: Sum Root to Leaf Numbers
zhlédnutí 78Před 2 měsíci
Leetcode 129: Sum Root to Leaf Numbers
Leetcode 2073: Time Needed to Buy Tickets
zhlédnutí 37Před 3 měsíci
Leetcode 2073: Time Needed to Buy Tickets
Leetcode 1700: Number of Students Unable to Eat Lunch
zhlédnutí 61Před 3 měsíci
Leetcode 1700: Number of Students Unable to Eat Lunch
Leetcode 1614: Maximum Nesting Depth of the Parentheses
zhlédnutí 41Před 3 měsíci
Leetcode 1614: Maximum Nesting Depth of the Parentheses
Leetcode 3101: Count Alternating Subarrays
zhlédnutí 130Před 3 měsíci
Leetcode 3101: Count Alternating Subarrays
so it means i was able to solve 90% of this problem on my own but i rather than dividing c/e[0], i was doing every loop which gave me tle. and whole time during contest i was thinking how to even convert it into O(N) 🙂
thanks!!
No idea about the other solutions you've solved. But this one is really simplified and nice way to explain. You've made it piece of cake and I was able to solve few other hard Leetcode questions with simply by swaps. Keep it up don't worry about number of views or comments. Cheers
good explanation
best video for this problem ! thhanks
Thank you for this simple explanation!
Thanks, great description.
Thank you so much. I love the clean solution. Subscribed, looking forward to see more videos from you in coming days.
Hi ! Thanks for the awesome explanation The above code fails for one test case (might have been upated) words = ["A","B"] , result = "A". I think the what they mean by no leading zeors is valid if the number if of length >= 2. Here we can see that the requirement is that B has to be zero!. Hence no leadning zeroes is applicable only if len(word) > 1. 2 minor fixes fixed the code for me. One was this : here we can use 0 even if the column == len(word)-1 if and only if the word is itself of length 1 # digit assignment already exists -> use it if letter in letterToDigit and not (letterToDigit[letter] == 0 and column == len(word) - 1 and len(word) > 1): return search(column, row + 1, bal + sign * letterToDigit[letter]) The other fix was Here we skip zero assignment even if column == len(words)-1 if and only if len(words) > 1. for d, c in enumerate(digitToLetter): if c is None: # the second condition is to prevent leading 0s if d == 0: if len(word) > 1 and column == len(word)-1: continue Again, thanks for the awesome explanation.
Thank you!
Very important. ❤great
that's just awesome. I was confused over the prefix sum In 2d array
From minite around 22, I believe in the matrix, should be "(i+1, k +1)"
I could not understand why you did return min(money/7, children -1)? money/7 would occur when money/7< children and children-1would occur when money/7 > children. so how you put both condition in one line?
U explained the concept very well thank u for helping out
whoa! I had never noticed LT has a button that analyzes the time complexity for us!
Thanks for the explanation! I was unable to come up with a (sub O(N^2)) solution on my own, and reading LeetCode's explanation several times didn't help. This is good.
Thank you so much ❤
thank You
Welcome back 🎉
thank you, great explanation
You're Impressive. thank you <3
THANK YOU
Thank you so much for your nice explanation, it really is easy.
The cleanest and readable solution I've seen for this problem, thanks
Doing great job with sharing best and easy solution !!
I think we can sort and get the last element in array which is largest and compare with first element of array which should be smalest then if abs both are equal then reutrn true , btw i am fan of your thinking startegy 🎉❤
this so diifcult,
I used a deque, and appended left until found, then regular append :D returned word if not found.
we are lucy to have you
Masterpiece explanation. I did this one in BFS but I like your way much better. Math is the best.
Great solution. Your explanation is really great. :)
This is amazing! This is the sort of solution I was looking for!
Hi! Thanks a lot for this solution and explanation, can you please explain a little bit more about complexity. Why is it R*log(R*n) if we do while loop logR times and inside loop we do 2*n operations (calling function f twice) it should be something like n*logR, shouldn't it?
thanks for the explanation. A quick question : The approach you mentioned here is DFS or BFS? because you have a queue as we use in BFS but then you don't visit all nodes in a list first so it's not level by level.
Good Explain
Elegant answer and explanation! You earned my like.
Great explanation :D
Slm, thanks for the explanations, I was looking for this problem's Moore Algorithm explanation, but you didn't mention it here, tho I saw that you talked about it in an older video.. but I had difficulties following it.., and the follow-up for the problem was O(n) time and O(1) space, anyways thanks alot! Eid Sa3id!
Thank you, i'll consider doing another Moore Algorithm video, Eid Mubarak :)
@@algorithmscasts902 thanks to you :D, i'm still struggling understanding it so i would appreciate it, thanks again!
thank you so much
Wow, this was a very good explanation. I'm so glad you posted it in the editorial because it is much better than the leetcode solution!!
very easy to understand and implement
Thank you! Your explanations are really good! They are the best( along with the channel codingMohan) I have seen on CZcams including popular channels like Neetcode,TakeuForward etc. Wish you would get more viewers!
thank you so much for the kind comment :)
was waiting for it, please do all of the contest problems
posted 2 of each contest, hope they help
nice one
can you give a formal proof of why only the minimum frequency character is the optimum. I get that it should be minimum only but can't prove it.
This is a non optimal solution. If there are N instances of c, the first N has a substring beginning with it and ending with all N instances of c. The next one has N - 1, etc. So you just need to count the instances of c, then take the sum of i from 0 to N, which is N(N + 1)/2. I wrote this in under 30 seconds and it solves the problem by checking each character exactly once, using a single integer variable, and doing a few arithmetic operations. pasteboard.co/3Rlb5RMsDyVr.png
Great 🇧🇩
There is a subtle detail here that is very easy to miss and also the genius part of this solution. Conventional logic dictates that we would find the max digit, record how many digits there were in the number and then start multiplying the max digit with powers of 10 for however many digits we get. For example, if our number is 523, our mx = 5 and count is 3. So we would do something like 5*10^0 + 5*10^1 + 5*10^2 = 5 + 50 + 500 = 555. Instead of doing that, all we want is the max digit in all places. So how about we build up the number in such a way that we have 1's everywhere and that is what line 12 is doing and the subtle part of the solution. What we are doing is actually building a number with 1's in all places equal to however many digits we have while finding the max digit at the same time. In our example of 523, our mul at the end of the while loop is actually 111 (replaced all digits with just 1's) and after that, we are guaranteed to have our max digit, so just multiply 111 with 5 to get 555.
This is so much more complicated than it needs to be.... Your solution is O(n) in both time and memory complexity. Technically it's 2 * O(n) because you're doing 2 loops. As one commenter said, startsWith and endsWith arrays are the same. Then you can notice that if the startsWith array has 4 elements, we will have the following: - For the element at index 0 in the startsWith array, you will have 4 substring: 0-0, 0-1, 0-2, 0-3. - For the element at index 1, you will have 1-1, 1-2, 1-3 - Then 2-2, 2-3 - Finally 3-3. This is 4 + 3 + 2 + 1. So you can notice that the solution will just be sum of all numbers up to the number of occurrences, aka (n * n(+1) ) / 2. So you can just have a single integer `numberOfOccurrencesOfC`, you traverse the `s` array and increment this counter each time you find a `c`. In the end you `return (numberOfOccurrencesOfC * (numberOfOccurrencesOfC + 1)) / 2`. O(n) time complexity, 1 memory complexity. ---- Though in an interview setting, I'm not sure if they would give you more points, because you "walked them through iterations of solutions" vs me who just immediately went through all the thinking in 2minutes, and arrived at the above solution without saying much.