Solving Amazon's 2024 Most Asked Coding Question

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 พ.ย. 2024

ความคิดเห็น • 10

  • @lylez00
    @lylez00 17 วันที่ผ่านมา +5

    I've been interviewing lately, and I'm not encountering any of these "common questions" I'm seeing on TH-cam. They're all different, and they're all hard. My question today - just the question and the examples of solutions was 63 lines, and I had about 20 minutes to solve it. I am so sick of the IT industry!

    • @duparcg
      @duparcg 14 วันที่ผ่านมา

      all the leetcodes you see online is bullshit. Most companies have theior custom ones and they are very hard. You have to get lucky bevause even if you understand its still going to be hard to solve and you may not even understand the problem after reading 100 times lol. TH-cam is a joke for software engineer trust me. even when you work as an engineer you wont be the crap peiople teach on youtube

  • @kmesh9
    @kmesh9 4 หลายเดือนก่อน +3

    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

  • @adilansari-hq9ge
    @adilansari-hq9ge 4 หลายเดือนก่อน +1

    Awesome Video. I have been missing your videos Michel, please keep uploading.

  • @danieladaniel2004
    @danieladaniel2004 4 หลายเดือนก่อน

    I love the way you explain these problems.

  • @isaacojigho4481
    @isaacojigho4481 4 หลายเดือนก่อน

    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

  • @LunaticZombie
    @LunaticZombie หลายเดือนก่อน

    Could you plz check following case:
    Forbidden=[de, le, e, mp]
    word=leetcodmpe
    Algo in video would give tcod as answer, but answer should be tcodm
    Am I missing something?
    Basically, thinking about matching substring of more than 1 length..

  • @allasbheen2634
    @allasbheen2634 3 หลายเดือนก่อน

    Explained great 👏👏👏

  • @kiranimmanni81
    @kiranimmanni81 4 หลายเดือนก่อน

    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 4 หลายเดือนก่อน +1

      "invalid" is a hash map so I assume time complexity for it would be O(1)