Solving Amazon's 2024 Most Asked Coding Question

  Рет қаралды 813

AlgosWithMichael

23 күн бұрын

Check out my interview prep platform for mastering the coding patterns!
📢 Interview prep platform: algoswithmichael.com
🔗 Social 🔗
🎧 Join the community Discord: discord.gg/aVWsAaaCtT
💰 Support me on Patreon: www.patreon.com/michaelmuinos
🔗Follow me on LinkedIn: www.linkedin.com/in/michael-muinos
📂Follow me on Github: github.com/MichaelMuinos
⭐️ Timestamps ⭐️
00:00 - Problem Examples
03:29 - Brute Force
04:31 - Algorithm
10:45 - Code
15:36 - Time & Space Complexity

Пікірлер: 7
@kmesh9
@kmesh9 23 күн бұрын
Good explanation, although it would've been good to clarify that it's not pointers moving backwards that allow us to skip most iterations from the bruteforce solution, but rather sliding window algorithm itself. You can reverse the solution and it would work perfectly as well - pointers go from left to right, but you do substrings from right to left (imo it would be a bit more intuitive to those already familiar with sliding window algorithm). You can even use something like ".endsWith(invalid[i])", though it would make time complexity a O(n*m*k), where k is length of the invalid array so with given constraints it would be worse, but generally might be better/same time complexity
@allasbheen2634
@allasbheen2634 9 күн бұрын
Explained great 👏👏👏
@adilansari-hq9ge
@adilansari-hq9ge 23 күн бұрын
Awesome Video. I have been missing your videos Michel, please keep uploading.
@isaacojigho4481
@isaacojigho4481 22 күн бұрын
Hey Michael this was a great video and I really appreciate it. Could you please provide the link for the list of questions you got this question from. you showed the page briefly at the 0:07 sec mark. the link to all questions by amazon in 2024 would be very helpful
@danieladaniel2004
@danieladaniel2004 23 күн бұрын
I love the way you explain these problems.
@kiranimmanni81
@kiranimmanni81 23 күн бұрын
Hi Michael, that’s a great explanation, though I noticed a small correction needed for your time complexity calculation. You forgot to include `invalid.contains(substring)`, which has a complexity of O(K) in this case (where K is 10^5, the length of the forbidden substring). So, the corrected time complexity is: O(N) { O(M) { O(M) + O(K) } } Thus, the total time complexity is O(N * M * (M + K)), or more succinctly, O(N * M^2 * MK). Hope this helps clarify! 😊
@kmesh9
@kmesh9 22 күн бұрын
"invalid" is a hash map so I assume time complexity for it would be O(1)
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 34 МЛН
WHAT’S THAT?
00:27
Natan por Aí
Рет қаралды 14 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 64 МЛН
Inside Out Babies (Inside Out Animation)
00:21
FASH
Рет қаралды 16 МЛН
My iPhone 15 pro max 😱🫣😂
0:21
Nadir Show
Рет қаралды 599 М.
ВАЖНО! Не проверяйте на своем iPhone после установки на экран!
0:19
ГЛАЗУРЬ СТЕКЛО для iPhone и аксессуары OTU
Рет қаралды 6 МЛН
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН