1 month ago. I received the Hello from Facebook email in the morning. It’s very interesting because I didn’t find any thing related to facebook jobs. They found me by somehow.
In next emails, I was told about infrastructure team and Visa project and other things then they want me to provide a date for phone interview also with a backup date. Due to a long Xmas holiday, so I decide to place technical interview on Jan-6.
I had very bad phone interview experience with HP Singapore before. The technical director with his Indian accents is very hard to listen. My current project, which have been 6 month, and all SEs use Indian accents, I can just hear about 60% of their conversation.
Come back to FB Interview. I have 4 weeks to prepare many thing. I learn from the Internet that their might be 2 coding questions each and some attitude questions. It’s been 5 years from my last ACM ICPC. That I don’t think I need to use such algorithms any more so I take time for me to practice the coding. I read again about complexity, some basic algorithm, searching, of course dynamic programming, my most favorable. Then I need to practice it with Python. Previous contest don’t allow python, but this is a fast coding language.
Because of timezone difference, I choose the schedule at 1 am. (10am PST)… This is one of my mistake.
My brain could work well at this time because of sleepy. Although I tried to stay late for week before…
I should choose 5 or 6am my time instead…
The interview started with some introduction about interviewer and me. Also with the question why facebook :). I told about my passionate with big system and high scalability.
Then start with coding question.
My most terrible mistake was I didn’t carefully read the statement of problem… Although the Interviewer asked me whether I understand the problem. But I was so self-confident about my self so that I didn’t read all the statement.
The problem was about max stock value buy and sell… Then I remembered that I solved it before with dynamic programming. So I reply right away. Interviewer asked me to just use first and simplest way…
Since this time. I was nervous, confused and unable to control my brain and my behavior. It take me about 20 minutes to write the solution. But when I finish, I realize this is not the answer. He just asked about 1 buy and sell transaction. Not for multiple transaction.
I was completely scared. I don’t know what to do next. I wasted my time for scaring about my mistake. Although I just need to edit one line of code for fixing this … If I was in just a programming contest at my high school. I could solve this problem in just 10 minutes.
But the time is out… I can’t submit my code… In just next 10 minutes I wrote 2 way of this problem with greedy – O(n^2) and dynamic programming O(n) (let me explain why I called it dynamic programming)
I sent an email with full solution and explain 10 minutes later. But I don’t think I have any other chances :).
l = len(a)
m = 0
for i in range(l):
for j in range(i+1,l):
if a[j]-a[i] > m:
m = a[j]-a[i]
m = 0
d = 0
for i in range(len(a)):
if a[i] d:
d = a[i]-a[m]
a = [20, 40, 52, 15, 30, 50, 10, 25]
This was my solution for wrong Problem
Come back to the dynamic programming:
– I called it this way because the formula would be
f[i] = max(f[i-1], a[i]-m[i]) for m[i] is minimum value until i position.
Because we just need to use i-1 value and one min value so we don’t need to store it in array.
I was failed this time. But I learned many things. So it’s a good thing come to me. Go to the SV might be a sweet dream but there might be next time :).
At least I knew that they found me, but they didn’t discover me :).
🙂 new game ideas for internal company contest :P.