solving the HARDEST leetcode problem in 40 lines - Strong Password Checker

Поделиться
HTML-код
  • Опубликовано: 29 янв 2025

Комментарии • 7

  • @voyeges
    @voyeges Год назад +3

    Most clear walkthrough (and done in the least amount of time) on strongest password checker i've seen. Thank you.

  • @user-vm5su2op7i
    @user-vm5su2op7i Год назад +2

    Best teacher/lecturer I've had at Cal. Speaks volumes

  • @amanfreecs
    @amanfreecs 6 месяцев назад +1

    I have come to this intuition by myself but i couldn't handle the case where length is greater than 20

  • @shirleyyu1630
    @shirleyyu1630 Год назад

    Very helpful thank you

  • @timeprotector4320
    @timeprotector4320 Год назад

    Sorry how is Case 1 a total of 3 ?
    Original AAABBB
    You are missing 2 types lowercase and a digit.
    So add a lower case and a digit to break up the substrings
    Edited AAcABB1B
    That's is a total of 2 changes ?

    • @TechTalk438
      @TechTalk438  Год назад

      Good question and apologies for the confusion. Case 1 lists 3 conditions we need to address in the ENTIRE string. AAABBB is just a *subset* of that string that I wrote out to illustrate how we address insertions / digits / triplets at the same time.
      Now that I think about it, it’s actually impossible that a string needs 3 inserts and has 2 triplets at the same time because if it needs 3 inserts, its total length should be 3. That’s probably why this was confusing to you.
      Apologies once again for the flawed setup; the main conclusion is still correct though and is the main takeaway. However many edits are required to address all of (missing types / triplets / inserts) is going to be max(num missing types, num triplets, num inserts). If it helps, you can imagine the problem description instead said the minimum length is 16 instead of 6 and revisit the 3 cases I listed-it’ll lead you to the same conclusion.

    • @timeprotector4320
      @timeprotector4320 Год назад

      @@TechTalk438 Thanks for the reply it was very late at night when I sent that message. I understand now and I was able to tackle it today it wasnt the cleanest solution but I am happy that I was able to take on the challenge :D
      Yeah it threw me off when you only showed the two subsets I thought that was the entire string