Tuesday, January 7, 2020

Case study: Minimized square sum algorithm mock interview

January 7, 2020

Introduction


It was my first mock interview on interviewing.io as an interviewee in 2020. The time was January 6, 2020, 8:00 PM. I like to write a short case study on this mock interview.

Case study


I was asked to work on the algorithm called minimize square sum.

This is my 7th interview as an interviewee. This is the first interview I was advanced to next round.

Cheers for the first success.


The problem statement link is here.
My first solution written with misunderstanding, here is the link.
My second solution written to solve the problem, brute force solution, here is the link.
Discussion how to use optimal time complexity, O(n). Here is the link.
Optimal Python solution shared by the interviewer. Here is the link.

With source code
The problem statement link is here.
My first solution written with misunderstanding, here is the link.
My second solution written to solve the problem, brute force solution, here is the link.
Discussion how to use optimal time complexity, O(n).
Optimal Python solution shared by the interviewer. Here is the link.

My feedback as an interviewee


Interviewer's feedback


Actionable Items


Jan. 9, 2020

Since it is my first interview which I could advance to next round, I like to document the time line of interview, and then figure out later when to improve and push myself to analyze the algorithm better at the very beginning.
0:00 - 7:50 read the problem and discuss the problem
7:57 - start to code
14:37  ran the code and fixed compiler error
16:32 - compiler erro
19:16 - Add test cases
Result "alice", "bob","bob", result: 5
       "alice", result: 1
22:20 "Alice", "Bob", "Charlie", should be 10, but my answer is 3.
29:11 Run test case by hand, "Bob", "Alice", "Bob", result should be 3
32:41 Fix the issue, write another function
38:00 - 40:00 wrote the code
40:00 - 42:00 fix compiler error
42:52 - test "Alice", "Bob", "Charlie", return is 10, correct
43:18 - test "Bob", "Alice", "Bob", 3
45:00 - 48:00 brainstorm how to optimize the solution
redundant work analysis by a simple example
52:00
54:00 - List<int[2]>> all intervals - discussion to calculate on the fly, no need to record all interval start and end, only care about square of range
55:00 - 60:00 the interviewer showed how to design a hashMap, and shared optimal solution - python code
63:00 - end the interview




No comments:

Post a Comment