FAANG Level Mock Software Engineer Interview (JavaScript)

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

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

  • @pmulard
    @pmulard 2 ปีที่แล้ว +32

    Just want to give a shout out to Daniel, who kept the interview lighthearted and fun :) I'm sure it goes a long way in easing the interviewee's anxiety and bringing out the best in them.

    • @DonTheDeveloper
      @DonTheDeveloper  2 ปีที่แล้ว +11

      Daniel is a goofy guy. I would have enjoyed being interviewed by him.

  • @varuntyagi6116
    @varuntyagi6116 2 ปีที่แล้ว +13

    That was a really nice interview. Shout out to Daniel for keeping it friendly and lighthearted the whole time. I've been in interviews where the interviewer was very rigid and it in-turn made me very nervous.

  • @ozzyfromspace
    @ozzyfromspace 2 ปีที่แล้ว +18

    This was actually a really good interview! Well done Brian!

  • @laszloekovacs
    @laszloekovacs ปีที่แล้ว +1

    I'm way too bad as a programmer but I managed to solve this with map, reduce. One of my proudest moments.

  • @jscul
    @jscul 2 ปีที่แล้ว +7

    It's funny this interview. At 10:25, the interviewer is actually wrong, you don't need quotes in JS. You can just do {a: 1, b: 2}. Python is the version where you'd need quotes. I'd probably comment on that and explain that in JS if you want to name something a key using a variable you would do {[a]: 1, [b]: 2}.

    • @davidwoods1337
      @davidwoods1337 2 ปีที่แล้ว +6

      He was probably thinking of JSON, which has mandatory quotes

    • @sehoonah7756
      @sehoonah7756 ปีที่แล้ว

      I was thinking this very same thing

  • @om3galul989
    @om3galul989 2 ปีที่แล้ว +2

    Thanks for the awesome interview!
    I was thinking, create trie out of words --> create freq map --> evaluate every word in the trie while using backtracking to undo modifications to the freq map.
    The efficiency here is that you don't recreate the freq map for each word + stopping early and not repeating work when evaluating words with same prefixes like 'dog' and 'dogs' etc..
    run time: O(2D + T ---> D + T) D is number of letters in trie, T number of tiles in freq map

    • @danieltomko4434
      @danieltomko4434 2 ปีที่แล้ว +1

      That's exactly right: preprocess. But not a TRIE for this problem. It doesn't actually help because you're not searching for a specific word, you're searching for words that can be MADE using the tiles.

  • @lailbeeb
    @lailbeeb 2 ปีที่แล้ว +6

    Daniel was awesome. It's better to have lighthearted goofy interviewer than stone faced interviewer who says nothing, I hate those interviews.

  • @Alddun
    @Alddun 2 ปีที่แล้ว +8

    Lets goo Brian!!!

    • @ronpaek100
      @ronpaek100 2 ปีที่แล้ว +3

      Let’s go Brain!! 🙌

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

    Feel like the first answer was over engineered/hard to read. Here is what I came up with:
    const scoreWord = (word, tiles) => {
    let result = 0
    for (const char of word) {
    if (tiles.includes(char)) {
    result += alphabet[char]
    tiles = tiles.replace(char, '')
    } else if (tiles.includes('_')) {
    tiles = tiles.replace('_', '')
    } else {
    return 0
    }
    }
    return result
    }
    and for second question:
    const scoreWords = (words, tiles) => {
    let score = 0
    let bestWord = ''
    for (const word of words) {
    let tempTiles = tiles
    let tempScore = 0
    if (word.length > tiles.length) {
    return
    }
    for (const char of word) {
    if (tempTiles.includes(char)) {
    tempScore += alphabet[char]
    tempTiles = tempTiles.replace(char, '')
    } else if (tempTiles.includes('_')) {
    tempTiles = tempTiles.replace('_', '')
    } else {
    continue
    }
    if (tempScore > score) {
    score = tempScore
    bestWord = word
    }
    }
    }
    return [score, bestWord.length > 0 ? bestWord : null]
    }
    console.log(scoreWords(['cat', 'dog', 'foo'], 'cado_f')) //[5, "foo"]

  • @pedroreyes5478
    @pedroreyes5478 ปีที่แล้ว

    Great interview and video!
    I felt like mentioning the optimization for the game of scrabble (wordbook wont change, can be fully processed) is kind of out of the scope of the problem at hand.

  • @arthurd4012
    @arthurd4012 2 ปีที่แล้ว +4

    Nice job Brian!

  • @SpinozicTroll
    @SpinozicTroll 2 ปีที่แล้ว +1

    Wow what an amazing interview, thank you so much for your content.

  • @mrawesome1821
    @mrawesome1821 2 ปีที่แล้ว +5

    Hey Don,
    Would you be willing to do interviews with some people are aspiring developers? I think it would be beneficial to interview those who are working to becoming a developer.
    LOVE THE VIDEOS!

    • @DonTheDeveloper
      @DonTheDeveloper  2 ปีที่แล้ว +1

      I'm definitely down to bring on aspiring developers for episodes. I believe I've created a post in the past inviting people, but no one followed through with it. Everyone wants to see episodes like that, but no one wants to volunteer.

    • @mrawesome1821
      @mrawesome1821 2 ปีที่แล้ว +1

      @@DonTheDeveloper
      I’m open to joining the conversation. My background is a little different which could make a discussion interesting.

    • @DonTheDeveloper
      @DonTheDeveloper  2 ปีที่แล้ว +1

      @@mrawesome1821 Sounds good. Go ahead and email me if you're interested in coming onto the podcast. You can find my email address on the About page.

  • @jjescandor191
    @jjescandor191 2 ปีที่แล้ว

    Here's my solution to the second problem:
    def max_score(list_str, tiles):
    max = 0
    word = ""
    for str in list_str:
    total = scorer(str, tiles)
    if total > max:
    max = total
    word = str
    return [max, word]
    print(max_score(["cat", "dog", "dogs", ], "tmac"))

    • @MocBocUS
      @MocBocUS ปีที่แล้ว

      yeah but your time complexity sucks

  • @trignal
    @trignal ปีที่แล้ว

    It's impossible to read the question. Can someone please post it here?

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

    The only thing that bothered me was that he was correct about copying the letters, all object keys are inherently strings and those keys were all valid var names in JavaScript. No quotes needed.
    Really cool interviewer, though. A+

  • @emmanuelU17
    @emmanuelU17 2 ปีที่แล้ว +1

    Zooming in would have been nice

  • @kevinnguyen1330
    @kevinnguyen1330 2 ปีที่แล้ว +1

    Great practice interview and great job to Brian! Was a interesting problem, as I also never played Scrabble. Was also fun to try it myself and ended up getting a different solution.
    Thanks for sharing!
    const dictPoints = {
    a: 1,
    b: 3,
    c: 3,
    d: 2,
    e: 1,
    f: 4,
    g: 2,
    h: 4,
    i: 1,
    j: 8,
    k: 5,
    l: 1,
    m: 3,
    n: 1,
    o: 1,
    p: 3,
    q: 10,
    r: 1,
    s: 1,
    t: 1,
    u: 1,
    v: 4,
    w: 4,
    x: 8,
    y: 4,
    z: 10,
    _: 0,
    };
    function getDictionary(object, key) {
    let result = object[key];
    return result;
    }
    function checkMap(tiles) {
    let map = {};
    for (let i = 0; i < tiles.length; i++) {
    if (!getDictionary(map, tiles[i])) {
    map[tiles[i]] = 1;
    } else {
    map[tiles[i]] += 1;
    }
    }
    return map;
    }
    function calculateWord2(array, tiles) {
    sum = 0;
    bestPoints = {};
    map = checkMap(tiles);
    array.forEach((string) => {
    sum = 0;
    for (let i = 0; i < string.length; i++) {
    if (getDictionary(map, string[i])) {
    sum += getDictionary(dictPoints, string[i]);
    map[string[i]] -= getDictionary(map, string[i]) - 1;
    }
    bestPoints[string] = sum;
    }
    });
    return bestPoints;
    }

    console.log(calculateWord2(["cat", "dog", "test"], "tke_skdac"));

  • @alexjosesilvati
    @alexjosesilvati ปีที่แล้ว

    Very good interview ingles!
    Is helping the interview...

  • @JJ-ps3vb
    @JJ-ps3vb 2 ปีที่แล้ว +5

    Isn't the time complexity of Q2 the same as checking the score for every word? He's just pruning the search but not improving the time complexity.

    • @garkman5000
      @garkman5000 2 ปีที่แล้ว +1

      Yep. Worst case time complexity remains the same but in real world cases this is an improvement. I do agree, it's kind of over engineering to address that in the first code through. Something to mentioning when asked, how to improve, IMO

    • @陈藏
      @陈藏 ปีที่แล้ว

      It will return early in the iteration of words, if the largest possible word has been found, right? Constructing words takes some time, but querying the maximum value saves time. It's even better if, in a real project, you need to query different tiles @@garkman5000

  • @allensun6329
    @allensun6329 2 ปีที่แล้ว

    And leetcode reference of the second problem?

  • @or2594
    @or2594 2 ปีที่แล้ว

    Well i would like to try (:

  • @mshawn3832
    @mshawn3832 ปีที่แล้ว

    I didn't understood the first question only can anyone explain it to me

    • @陈藏
      @陈藏 ปีที่แล้ว

      Is it possible to get the word using the letters in the tiles, each letter can only be used once, underscore can represent any letter. Each letter has a value. Return the value of the word(each letter plus)

  • @emmanuellmiqueletti7029
    @emmanuellmiqueletti7029 ปีที่แล้ว

    Actually using a Trie tree in this problem would increase the complexity so much. I like the map approach.

  • @hai-quanzhang7335
    @hai-quanzhang7335 2 ปีที่แล้ว

    Nice job

  • @阳蔡
    @阳蔡 2 ปีที่แล้ว +2

    SamWell in GOT?

    • @DonTheDeveloper
      @DonTheDeveloper  2 ปีที่แล้ว +2

      I was nothing at all, and when you're nothing at all, there's no more reason to be afraid.

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

    I am supposed to have an interview in a couple of weeks, after seeing this I should just cancel it and save myself and my interviewer time.

  • @RedOctober46
    @RedOctober46 ปีที่แล้ว +1

    Live tech interviews make me cringe. I am forced to give them for interviews at my job and I hate them every time. Better options are to give the candidate a small project that might take a couple days or a weekend to complete. Also, can do it proctored to safeguard against any cheating (thanks to covid tons of services now exist). This would be a more real-life demo of their ability. Also, the dedication to complete it would scare off most, less dedicated people immediately. I know GitLab does something like this already.

  • @ifuloseurbad
    @ifuloseurbad 2 ปีที่แล้ว

    FIRST