Saturday, September 22, 2018

My fourth interview on interviewing.io

Sept. 22, 2018

Introduction


It was my 9:00 PM mock interview, and it was my fourth interview as an interviewee. I had chance to work with the interviewer, and I answered the first three algorithms and explained the ideas in the first 12 minutes, and then moved on the fourth algorithm which is the hard level Leetcode 212 Trie. I explained the idea how to solve the algorithm, and wrote the code until we reached 45 minutes mark. We chat about 15 minutes about practicing and learning.

I had 10:00 PM mock interview as an interviewer, and I did not explain to the interviewer of 9:00 PM until 10:01 PM. I rushed to say goodbye and then started my 10:02 mock interview.

My performance


Group anagrams

Given an array of strings, group anagrams together.
Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
count[26] -> eat -> [0] 1, [4], 1, t 1 -> what generate: a-1 e-1 t-1
Minimum meeting rooms

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
Input: [[0, 30],[5, 10],[15, 20]]
Output: 2
line sweep algorithm
0 --------------------------30
5----10 15------20
--------------------------------->
0 - room +1
5- room + 2
10 - end meeting room 2 - 1 = 1
15 - new meeting room : 1 + 1
20 - end meeting -> room: 2 - 1 = 1
30 - end meeting -> room 1 - 1 = 0
max (1, 2, 1, 2, 1, 0) -> 2
key - value , time - bool isStart, 0 (start, end)
all keys - integer -> O(nlogn)


Find words in the dictionary

/*
Given a 2D board and a list of words from the dictionary, find all words in the board.
Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word.
Input:
words = ["oath","pea","eat","rain"] and board =
[
['o','a','a','n'],
['e','t','a','e'],
['i','h','k','r'],
['i','f','l','v']
]
Output: ["eat","oath"]
letter
a b c .............z
o p
/ /
a e
/ /
t
/
h
e
/
a
/
t
r
/
a
/
i
/
n
constraint:
*/
using System;
// To execute C#, please define "static void Main" on a class
// named Solution.
class Solution
{
static void Main(string[] args)
{
for (var i = 0; i < 5; i++)
{
Console.WriteLine("Hello, World");
}
}
internal class Trie
{
public char Symbol{get; set;}
public Trie[26] Children {get; set;}
bool IsWord {get; set;}
public Trie()
{
//
}
// add
// search
}
///
public static IList<string> FindWords(char[,] board, string[] words) {
if(board == null || words == null)
return new List<string>();
var dummyNode = new Trie(); // letter ->
putAllWordInTrie(dummyNode, words);
var rows = board.GetLength(0);
var cols = board.GetLength(1);
var wordsFound = new List<string>();
///
var visited = new bool[rows,cols]; //visited true/ false, 0, 1, 2
for(int row = 0 ; row < rows; row++)
{
for(int col = 0; col < cols; col++)
{
var current = visited[row, col];
if(current)
continue;
searchTrie(dummyNode, row, col, visited, board, wordsFound);
}
}
return wordsFound;
}
private static searchTrie(Trie dummyNode, int startRow, int startCol, bool[,] visited, char[,] board, IList<string> wordsFound)
{
var current = board[startRow, startCol];
//
var next = dummyNode.Children[current - 'a'];
if(next == null)
return;
if(next.IsWord)
{
wordsFound.Add(); // words
}
}
}

My feedback as an interviewee


Would you want to work with this person? *

Yes

How excited would you be to work with them? 


Where do I sign?!!?

How good were the questions? 


Really useful/awesome!

How helpful was your interviewer in guiding you to the solution(s)? 


Awesome!

Help your interviewer get better! 




Interviewer's feedback


Do you want to advance this person to the next round (e.g. onsite)? *

No

How were their technical skills? 

starstarstarstar
Could use improvement

How was their problem solving ability? 

starstarstarstar
Could use improvement

What about their communication ability? 

starstarstarstar
Amazing!

Help your interviewee get better! 

No comments:

Post a Comment