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.
@pmulard2 жыл бұрын
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.
@DonTheDeveloper2 жыл бұрын
Daniel is a goofy guy. I would have enjoyed being interviewed by him.
@ozzyfromspace2 жыл бұрын
This was actually a really good interview! Well done Brian!
@jscul2 жыл бұрын
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}.
@davidwoods13372 жыл бұрын
He was probably thinking of JSON, which has mandatory quotes
@sehoonah7756 Жыл бұрын
I was thinking this very same thing
@om3galul9892 жыл бұрын
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
@danieltomko44342 жыл бұрын
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.
@Alddun2 жыл бұрын
Lets goo Brian!!!
@ronpaek1002 жыл бұрын
Let’s go Brain!! 🙌
@austinlawan3289Ай бұрын
Thank you for these sessions guys. They very very helpful.
@lailbeeb2 жыл бұрын
Daniel was awesome. It's better to have lighthearted goofy interviewer than stone faced interviewer who says nothing, I hate those interviews.
@laszloekovacs Жыл бұрын
I'm way too bad as a programmer but I managed to solve this with map, reduce. One of my proudest moments.
@austinlawan3289Ай бұрын
I was looking for this very comment. I was able to easily solve this with map as well.
@arthurd40122 жыл бұрын
Nice job Brian!
@SpinozicTroll2 жыл бұрын
Wow what an amazing interview, thank you so much for your content.
@trignal Жыл бұрын
It's impossible to read the question. Can someone please post it here?
@mrawesome18212 жыл бұрын
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!
@DonTheDeveloper2 жыл бұрын
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.
@mrawesome18212 жыл бұрын
@@DonTheDeveloper I’m open to joining the conversation. My background is a little different which could make a discussion interesting.
@DonTheDeveloper2 жыл бұрын
@@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.
@pedroreyes54782 жыл бұрын
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.
@qaqiaq420011 ай бұрын
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"]
@allensun63292 жыл бұрын
And leetcode reference of the second problem?
@jjescandor1912 жыл бұрын
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 Жыл бұрын
yeah but your time complexity sucks
@alexjosesilvati Жыл бұрын
Very good interview ingles! Is helping the interview...
@JJ-ps3vb2 жыл бұрын
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.
@garkman50002 жыл бұрын
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
@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)
@ericnail111 ай бұрын
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+
@emmanuelU172 жыл бұрын
Zooming in would have been nice
@阳蔡2 жыл бұрын
SamWell in GOT?
@DonTheDeveloper2 жыл бұрын
I was nothing at all, and when you're nothing at all, there's no more reason to be afraid.
@kevinnguyen13302 жыл бұрын
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"));
@or25942 жыл бұрын
Well i would like to try (:
@emmanuellmiqueletti7029 Жыл бұрын
Actually using a Trie tree in this problem would increase the complexity so much. I like the map approach.
@hai-quanzhang73352 жыл бұрын
Nice job
@dinahlizett Жыл бұрын
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 Жыл бұрын
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.