VERIFYING AN ALIEN DICTIONARY | LEETCODE 953 | PYTHON SOLUTION

Sdílet
Vložit
  • čas přidán 9. 07. 2024
  • Channel Discord Community: / discord
    Problem Link: leetcode.com/problems/verifyi...
    Today we are solving a cool easy level question that actually used to be Meta's top interview question before the hiring freezes: Verifying an Alien Dictionary. It's quite a fun problem and pretty easy to solve though there are some minor gotchas we need to watch out for.
    TIMESTAMPS
    00:00 Intro
    00:08 Question Prompt
    00:54 Basic Examples
    02:56 Solution Intuition
    04:58 Coding
    10:47 Time/Space Complexity
    12:45 Outro
  • Věda a technologie

Komentáře • 4

  • @user-ff2ep5kk5i
    @user-ff2ep5kk5i Před 4 měsíci

    Congrats on 10k!!

  • @Liteship
    @Liteship Před měsícem

    can you please do leetcode 529: minesweeper?

  • @louie0187
    @louie0187 Před 4 měsíci

    10k!! Congrats, but should be more. if one video helps you in your interview prep, you should be subscribing.

  • @theFifthMountain123
    @theFifthMountain123 Před 2 měsíci

    Slightly modified your solution:
    def isAlienSorted(self, words: List[str], order: str) -> bool:
    order = { val: index for index,val in enumerate(order)}
    def lexico(word1, word2):
    for i in range(min(len(word1), len(word2))):
    if word1[i] != word2[i]:
    return order[word1[i]] < order[word2[i]]
    return len(word1)