FAANG Level Mock Software Engineer Interview (JavaScript)

preview_player
Показать описание

Disclaimer: Some product links are affiliate links which means if you buy something I'll receive a small commission at no extra cost to you.

===========================
WEBDEV COURSES I HIGHLY RECOMMEND:

===========================
PRODUCTS I PERSONALLY USE AND LOVE:

---------------------------------------------------

I hosted a 3rd and final mock interview with this series of FAANG-level coding challenges. Daniel, the interviewer, has almost 20 years of experience as an engineer between Microsoft and Facebook. We found a brave soul to be the interviewee and he actually got to the final challenge in this interview. If you want to see what the coding challenge of a FAANG level software engineer interview looks like, this episode is for you. Enjoy!

Sections:
0:00 - Intro
3:57 - 1st coding challenge
18:28 - 2nd coding challenge
48:19 - Questions and feedback
59:23 - Outro

Daniel Tomko (guest):

Brian Do (guest):
Рекомендации по теме
Комментарии
Автор

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.

varuntyagi
Автор

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

ozzyfromspace
Автор

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.

pmulard
Автор

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}.

jscul
Автор

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

omgalul
Автор

Thank you for these sessions guys. They very very helpful.

austinlawan
Автор

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

laszloekovacs
Автор

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

lailbeeb
Автор

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

SpinozicTroll
Автор

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.

pedroreyes
Автор

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!

mrawesome
Автор

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

trignal
Автор

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

alexjosesilvati
Автор

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"]

qaqiaq
Автор

And leetcode reference of the second problem?

allensun
Автор

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"))

jjescandor
Автор

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.

JJ-psvb
Автор

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"));

kevinnguyen
Автор

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+

ericnail
Автор

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

mshawn