Showing posts sorted by relevance for query competitive programming. Sort by date Show all posts
Showing posts sorted by relevance for query competitive programming. Sort by date Show all posts

Wednesday, February 24, 2016

Algorithm contests? Competitive programming?

Feb. 24, 2016

 Algorithm contests are great tools to use. It takes more critical thinking, and more attention to detail in order to gain points. Julia did two easy questions on two hackerRank contests last weekend, she could not perform on easy question in 20 minutes each. She actually spent over 60 minutes, hard to concentrate, felt stressed. So, she did some research and look into articles talking about programming contests and how she can improve in short time: 

 3 popular contests sites:
 1. HackerRank
 2. TopCoder 
 3. CodeJam

Her favorite article detailed on this - Preparing for a technical interview with programming contests:
https://www.facebook.com/notes/10151298476823920
  • You’ll learn how to critically analyze your work. Because you don’t get credit for solving a problem until the code you write can generate the correct results for a large input set (and you don’t know what that input set looks like), you’re forced to think about things such as time complexity, memory usage, and nasty corner cases. Importantly, most of this work happens outside the context of a debugger. Debuggers are invaluable tools for figuring out why a given piece of code is buggy, but it’s better if you can write bug-free code in the first place. In an interview situation, candidates who can’t statically analyze their code generally have trouble showing their solution is correct (or figuring out why it’s not).
https://medium.com/@dpup/whiteboarding-4df873dbba2e#.ps92c99lb
https://code.google.com/codejam/contests.html
https://code.google.com/codejam/contest/6224486/dashboard#s=a&a=0 
http://blog.hackerrank.com/3-ways-crush-technical-interview/
https://www.quora.com/How-has-competitive-programming-helped-you-get-a-job
http://www.redgreencode.com/12-reasons-to-study-competitive-programming/
https://www.quora.com/What-is-the-best-strategy-to-improve-my-skills-in-competitive-programming-in-2-3-months

https://www.quora.com/How-did-Anudeep-Nekkanti-become-so-good-at-competitive-programming

Things to do in next month:
Work on contests every week, 2 - 4 hours. Try to aim for 20 hours experience first.


Monday, February 27, 2017

Are programming competition a good use of time?

Feb. 27, 2017

Introduction


Julia came cross the article after she studied hackerrank university codesprint #2 leaderboard.

Argument No. 1 in the article  

Competitive programming promises even more glory. Win enough contests, and you get an interview at Facebook or Google, where they ask you… you guessed it… more algorithm coding questions!


Argument No. 2 in the article 


By doing programming contests, you gain an intimate understanding of data structures and algorithms and their complexities. While your colleagues vaguely know the difference between a depth-first versus a breadth-first search, you develop a much deeper intuition. You will never forget that one contest where you used DFS instead of BFS, causing your solution to time out.

Fact 1 to share 


Julia won 4 bronze medals in last 12 months, and also played a few other contests as well, here are the details: 

4 bronze medals: 

university codesprint 2  (1247/ 6587) Feb. 2017
Week of Code 27             (1643/ 7476) Dec. 2016
world codesprint 7         (863/ 5649)   Sept. 2016
world codesprint 6        (1168/ 5270)  Aug. 2016

contests: 

NCR CodeSprint                 (479/ 2617)   Nov. 2016
OpenBracket CodeSprint  (482/ 2448)  Oct. 2016
Stryker CodeSprint             (174/ 1929)   Sept. 2016

Fact 2 to share

Julia worked on the queue and caused a big issue like timeout, she wrote a blog talking about sinking sand - a test case is rock to build on algorithm. She learned the lesson of BFS using queue, over 4 hours work ended up scoring 0.   


Argument by Google director of research - Peter Norvig

Is this a valid argument? Winning at programming competitions is a negative factor for being good on the job.


Argument 3 in the article

Given the amount of time it takes to master competitive programming, one naturally wonders: is this really a good use of time? In a contest, you are ultimately solving problems that other people have solved already, so nothing new is being produced. Although solving a contest problem is satisfying, I find it a lot more rewarding to build projects or apps with my novel ideas.


Competitive programming 

whole weekend one medium algorithm

To play a contest on Hackerrank, Julia calculates some math. She has to dedicate herself whole weekend in order to get a medium algorithm done. She has to entertain herself first, play some music, lookup her ideas by Google, write some simple idea to play against hackerrank test case, until she warms up with the algorithm. Sometimes, it takes 5 - 6 hours until she failed so many times and then she understands the problem - what is the real challenge in the problem statement.

code review catching up more

All those hours and labor build up her character, she never experience this kind of research before. Over 10 hours, she makes something happen, solve a medium algorithm. Sometimes a medium algorithm can take her a few days after the contest. Since Nov. 2016, a few times, she has to continue to catch up more research after the contest, and then work on codereivew.stackexchange.com, get some help and find something more interesting to continue.

Julia learns to work on one algorithm a time, and also has to learn to let it go one a time. She knows that she will forget the algorithm completely, it does not matter how hard she intensively trains herself in the contest/ after the contest, and she needs to relearn it one day. Only thing left is something surprising, her new character still trying to mold, the strong determination to solve the problem. The will, or the intuition to try new ideas, relentlessly. That is something different she could not find in the training of Leetcode algorithms. Julia was surprised that she continuously improves over last few months.


Hackerrank contest  algortihms 


Things Julia should have done are to evaluate those easy, medium algorithms in past 10 contests on Hackerrank; Do those algorithms shape her very well as a sports programmer,  what are atlernatives? Julia does not like the inactive learning, by memorizing, she likes more about competition, with time limitation. 


Friday, September 2, 2016

Book reading: competitive programming

Sept. 2, 2016

Plan to spend 30 minutes a time, up to 10 hours to read a short book - 152 pages first.

Competitive programming course:

Free download - version 1


Julia spent more than 1 hour to look into lead board of HackerRank, and then, she found the book to read:

https://algo.is/
competitive programming course

https://sites.google.com/site/stevenhalim/

Free download - version 1

Competition course


Julia is looking for a book talking about suffix array etc. advanced data structure. She found one today.

Write down some great ideas after reading. 

1. 10 terms Julia's favorite from the book:
1. Simple array that is pre-preprocessed with Dynamic Programming - Data Structure term (page 7)
2. Page 11, a form of Hash Table - ‘Direct Addressing Table’ (DAT) 

2. Page 8 Question:
2. Given a list of integers L of size up to 1M items, determine whether a value v exists in L?

(More details in Section 2.2.1).

Page 16 - Balanced Binary Search Tree (BST): C++ STL <map>/<set> 
Java TreeMap/TreeSet 
argument: implement a bug-free balanced BST like AVL Tree or Red-Black (RB) Tree is tedious and hard to do under time constrained contest environment. 

3. Look into those typical problems, first, remember the terms - Page 17 - Page 18 
Spend 30 minutes for each problem - warmup, and get traditional problems into daily routine - talk, warmup, and study some implementation using C# as well. (9/11/2016 - 1:21pm)

Programming exercises to practice using basic data structures and algorithms (with libraries):
• Static array, C++ STL <vector>, <bitset>, Direct Addressing Table
1. UVa 482 - Permutation Arrays (simple array manipulation)
2. UVa 594 - One Two Three Little Endian (manipulate bit string easily with <bitset>)
3. UVa 11340 - Newspaper (Direct Addressing Table)

• C++ STL <algorithm>
1. UVa 146 - ID Codes (use next permutation)
2. UVa 10194 - Football a.k.a. Soccer (multi-fields sorting, use sort)
3. UVa 10258 - Contest Scoreboard (multi-fields sorting, use sort)

• Sorting-related problems
1. UVa 299 - Train Swapping (inversion index3 problem solvable with bubble sort)
2. UVa 612 - DNA Sorting (inversion index + stable sort)
3. UVa 10810 - Ultra Quicksort (inversion index - requires O(n log n) merge sort)
4. UVa 11462 - Age Sort (counting sort problem, see [4])
5. UVa 11495 - Bubbles and Buckets (inversion index - requires O(n log n) merge sort)

• C++ STL <stack>
1. UVa 127 - “Accordian” Patience (shuffling <stack>)
2. UVa 514 - Rails (use <stack> to simulate the process)
3. UVa 673 - Parentheses Balance (classical problem)
4. UVa 727 - Equation (Infix to Postfix conversion)

• C++ STL <queue>
1. UVa 336 - A Node Too Far (<queue> used inside BFS, Section 4.3)
2. UVa 10901 - Ferry Loading III (simulation with <queue>)
3. UVa 11034 - Ferry Loading IV (simulation with <queue>)

• C++ STL <map>/<set>
1. UVa 10226 - Hardwood Species (use <map>)
2. UVa 11239 - Open Source (use <map> and <set> to check previous strings efficiently)
3. UVa 11308 - Bankrupt Baker (use <map> and <set> to help managing the data)
4. UVa 11136 - Hoax or what (use multiset in <set>)

• C++ STL priority queue in <queue>
1. UVa 908 - Re-connecting Computer Sites (priority queue in Kruskal’s, Section 4.4)
2. UVa 11492 - Babel (priority queue in Dijkstra’s, Section 4.5)
3. LA 3135 - Argus (Beijing04)

Find a website about Ultra quicksort:

https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1751


Nov. 24, 2016
C# book reading:


Sunday, June 25, 2017

3000 algorithm practice

June 25, 2017

Introduction



It is estimated that a good software programmer should practice at least 3000 easy and medium algorithm based on her research on competitive programming. Right now, Julia had around 800 algorithm in her gist profile. It takes a while Julia adopts the idea called one algorithm a time based on her research on tennis coaching and mental strategies study. Never rush herself to finish algorithms. She used to study 10 algorithms in 3 hours, or 30 algorithms in one week, or tried to go over 70 algorithms in 3 or 4 hours.

It is better to learn one algorithm a time. Based on her study of the book "The art of competition programming", the book chapter the game plan of contest, Julia learned that it is also very helpful for her to go over each algorithm as many as possible ideas based on Leetcode discussion. She also learned that it is also very helpful to solve an expert level algorithm, in order to find a solution, Julia will quickly build up skills to do some research on algorithm, review the basics, and tries a few ideas.

Small research talk 



Read the blog again, link is here. Read the article again called "Competitive programming is a good use of time".

Review 3 advanced topics for competitive programming:

1. Fenwick tree
2. Max flow algorithm
3. Bitmask DP

Try to answer a few questions on Fenwick tree - binary index tree

One discussion on binary index tree is here on cs.stackexchange.com.

Second discussion on Fenwick tree is here on cs.stackexchange.com.

Study Hackerrank ProjectEuler+ leaderboard - link is here.

Sunday, August 20, 2017

Square root decomposition in competitive programming

August 20, 2017

Watch the video 1 hour 44 minutes, the video link is "Square Root Decomposition in Competitive Programming".

Anudeep Nekkanti was a googler who presents the talk.

I spent time to go over all the questions he answers on quora.com while listening to the video.

A lot of questions and answers about competitive programming and intern, and other things.


45:00/ 1:44:40
Question: How to code fast?

He talked about how to write code, the expert writes the code slow, white board testing. Compared to write code first, and then spent time on debugging. The expert chooses the first choice. Debugging takes a lot of time.

Be accurate, be more thoughtful, it is not the typing fast.

47:11 / 1:44:40
Google interviewer even does not understand your code. He keeps saying, check your code 5 minutes, make sure that everything is correct.

50:14 / 1:44:40

Google interviewer tried to see how you solve the problem.

1:12 talk about the algorithm and then give some examples:

Unbelievable, I finished the video at 1:02 pm. It took me over 110 minutes. Last 30 minutes, the presenter gave talks about algorithms related to square root decomposition, like Mo's algorithm.

Sunday, September 11, 2016

HackerRank contest - stryker codesprint preparation talk

Sept. 11, 2016
It is always a good idea to learn how to prepare very well for a programming contest. Five days away. Let us count down.

Preparation of the coming contest:
Register stryker codesprint  - Sept. 17, 2016

Get prepared, and things to look into:

1. How to prepare for the codesprint?

1. Read the competitive programming book - time analysis, data structure etc.

2. Learn to solve problems using traditional solutions

3. Read some Leetcode solutions - 2+ hours
http://juliachencoding.blogspot.ca/2016/09/a-drill-c-learning.html


4. Read the article - why the company sponseres codesprint?

https://www.hackerrank.com/codesprint5/sponsor
https://www.hackerrank.com/work/customers/rocketfuel
https://www.quora.com/What-is-the-benefit-of-solving-problems-on-HackerRank

Julia only has 4 contests so far/ less than 6 months contest experience vs people over decades of contest experience; be realistic, be pragmatic

Read the article:
https://en.wikipedia.org/wiki/Competitive_programming

Borrow ideas from professional tennis players and teaching pros on contest preparation:

Professional WTA player habits:

1. http://www.humankinetics.com/excerpts/excerpts/learn-the-practice-habits-of-tennis-professionals

Practice to win
Learn to concentrate

Visulization/ margin of error -

2. The 7 Habits of Successful Teaching Pros

http://www.tennisindustrymag.com/articles/2011/01/2_the_7_habits_of_successful_t.html

Blog reading:
1. How to spend the time?
https://www.quora.com/What-are-some-tips-for-programming-interviews-Amazon-Facebook-Microsoft-etc

Julia's note: apply separation of concern, abstraction level -> go to various abstraction level -> various functions, main

concern/ trivial jobs;
main target is to cut time to short, leave time for second question, or things to ask.

5 minutes costs a job - in other words, give different priority for different tasks -
45 minutes interview time / 25 minutes is a threshold - do not push over 25 minutes, leave 20 minutes for something more

meaningful - prepare questions to ask/ figure out if you are best fit/ what is biggest hurdle to overcome

2. 20 minutes reading:
http://www.mohsinali.net/guide.html#prep

3. Leetcode 307: Range sum Query
Spent time to read segment tree - 2.3.3, page 22, 23, 24, competitive programming book.

 So, Julia likes to have some practice on segment tree.

Will come back very soon.

Sunday, September 4, 2016

Leetcode 72: Edit distance - code study

Sept. 4, 2016

First thing in the morning, this Sunday, labor long weekend, Julia read the book about "competitive programming. She read the book -
page 112,
6.3 String Processing with Dynamic Programming
6.3.1 string alignment - edit distance

Using Dynamic Programming, she was amazed that how good the solution is provided in the book. She read aloud the analysis and solution word by word, sentence by sentence, a few times. So enjoyable experience.

The book is detailed in the previous blog:
http://juliachencoding.blogspot.ca/2016/09/book-reading-competitive-programming.html

So, she looked up google and found the similar algorithm: Leetcode 72 - edit distance
Problem statement: (Hard)
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 operations permitted on a word:
a) Insert a character
b) Delete a character
c) Replace a character
Blog reading:
1. Machine learning - 
http://www.hpl.hp.com/news/2011/jul-sep/luluhe.html

Thursday, June 8, 2017

Leetcode 123: Buy and sell stock III

June 8, 2017

Problem statement

It is hard level algorithm. And it can be solved using dynamic programming. It is challenging task to solve a dynamic programming algorithm.

Now it is 10:39 pm, Julia likes to choose a topic to do a short research, what you should do if the algorithm is too hard to solve? 30 minutes research.

10 steps to master dynamic programming


1. Watch a video to relax, I found one - google developer talked about competitive programming. Here is the link, 1 hour 44 minutes.

2. Read a math lecture note from brown university, lecture note is here. Read a mathematician web page and learn some research idea here.

3. Dynamic programming should be renamed. Discussion is here.

4. Read a median age article and talk about AWS - link is here.

5. Work on interviewbit.com dynamic programming problems, the link is here. (June 16, 2017)



Follow up 


June 9, 2017

Julia's C# practice is here.

June 12, 2017

Julia's talk about the algorithm design

It is a good ritual to talk about the design, make a story, structure the story the way easy to recall, and also very well structured highlighted with keywords using different colors. The true nature of dynamic programming reminds us spend more time to write a story, spend less time to write the code.

Here are the highlights of story to buy and sell stocks. One transaction, multiple choice of purchase time, how to find maximum value? how to introduce the recurrence formula?

First let us talk about buy and sell stocks algorithm here on Leetcode 123. As a recursive solution nature, we only need to discuss one transaction in the design. We need to consider when to purchase, when to sell.

One transaction leads us to think about the last transaction. The last time stamp index to sell or not sell the stock.

Assume that we sell at time stamp index, and we can purchase anytime before index, in other words, any j from 0 to index – 1. The overall profit can be expressed using  the profit based on j and then last transaction profit prices[index] – prices[j].
Let us talk about multiple choices, and what is the optimal value? Find the maximum values in all the options.

Next, let us introduce the recurrence formula. Define a profit function called profit(k, j), where k is the number of transactions and j is the time stamp. 


f[k, index] = max(f[k, index - 1], max(prices[index] - prices[j] + f[k - 1, j]) for any j in range of [0, index - 1])


Follow up 


I had a mock interview on January 28, 2018, and after the mock interview the peer shared with me how he learned the algorithm through $50.00 purchase of courses on algoexpert.io. I found this free lecture on the algorithm Leetcode 123: Buy and Sell stock III.

Thursday, March 29, 2018

Being interviewee: Leetcode 10: regular expression matching

March 29, 2018

Introduction


It is my sick day. I have to stay at home. Yesterday I noticed that my nose was running and made sneeze, one of coworkers asked me if I was sick. I told her that I had allergic. But I had to honestly admit that I had a cold, I could not go to work and stay at home.

I had 10:00 AM mock interview, I had to work on Leetcode 10: regular expression matching algorithm. I spent 34 minutes to write analysis and code, I fixed a few bugs to pass all test cases.

Code review


Here is my analysis and C# code.

I like to write down my misunderstanding in my first writing, and then how I fixed the bug through the white box testing and web compiler.

For example, to build a dynamic programming table, I have to work on "b", "b*".

                    ""  "b"   "*"
                    ""  "b"   "b*"  - pattern
              --------------------
""    ""         T     F      T
"b" "b"        F     T      T

In order to calculate dp[row, col], I need to find the text char and pattern char first, and then work on current char only.

Highlights of bug fix after first writing in mock interview:

1. I did white box testing, need to fix the bug using test case "" matches pattern string "a*b*". I added line 21 to line 33.
2. web compiler runs the test cases. I failed most of test cases.
I noticed that I could not memorize the solution. I need to work on the solution itself.
I fixed line 25 checking pChar == '*' instead of checking pChar and its next char.
3. line 40, check pChar is '*' instead of checking next char is '*'.
4. line 46, col - 1 instead of col - 2 which causes index out of range error.

Dynamic programming quote


Today's quote on dynamic programming. I think that I learn something from today's practice.

Work on dynamic programming, do not worry about next char. Work on current char only. 

Best medicine to cure my cold


Here is the feedback I got from the peer. It helps me to recover from my cold. Actually the peer is very competitive programmer on codeforece.com, expert with contest rating: 17xxx ( max: expert, 1886), competitive, also on hackerrank.com with 5 gold medal.

One more practice


I knew that I was sick with a cold, and then I felt some nervous in mock interview. It is hard to write a dynamic programming solution in less than 30 minutes.

I knew that something will go wrong. To learn a hard level algorithm, I have to be so patient and let myself make mistake first; and then find the ways to fix it in mock interview, and also in less than 30 minutes.

First of all, I mixed the dynamic programming solution with recursive solution. Since my last practice I spent over 40 minutes to write a recursive solution in mock interview to play with a friend less than one month ago. I look ahead for star pattern, current char is a - z, I check if next char is star. But it is wrong to do that in dynamic programming, mix current problem with next problem.

Dynamic programming is to work on the current problem and use subproblems cache results.



Monday, May 22, 2017

The art of programming contest

May 22, 2017

Plan to read the book "The art of programming contest". Julia read the discussion of special substrings algorithm in the week code 32 contest, here is the discussion link. Read the discussion:

"I studied Programming Challenges 3, Programming Contests, Hitchhiker's Guide to Competitive Programming and the Art of Programming Contests. I know what the most frequent algorithms is."



Write down a note to finish 30 minutes reading each time here.

1. May 22, 2017  12:04 pm - 12:34 pm

Chapter 2 Game Plan for a contest

Monday, February 20, 2017

Hackerrank university code sprint #2 - Bronze medal

Feb. 20, 2017

Julia was so happy to know that she got a bronze medal for her most favorite codesprint - university codesprint. She scored 50, spent more than 15 hours, compared to highest rank scoring 100%, score 430, in less than 3 hours, she has a long way to go. But she knew that how hard she has to work on, to make that extra 30 points, her last university codesprint was 20 points, because she spent over 10 hours to work on hard algorithm array construction, ended up scoring 0 on the algorithm.

The university codesprint is by far most challenge codesprint one.

She did look up ranking in Canada, and tried to learn through leaderboard, she ranks at 38, and also she found a good article to read from Bai Li, ranking , score 179.80, 245/6591.

Read his blog about competition programming to talk about rankings.

Study other players, and try to figure out how they got so advanced skills in competitive programming. 


Bai Li - HackerRank
How to succeed in your intern?
Erick Lin - How does an undergraduate do?

Hieu Le

Corey Chen

Marek Cygan
Abu Naser Bikas

competitive programming blog

Thursday, March 10, 2022

Good advices: interview preparation

Here is the article.

Your ultimate guide to interview preparation

11 November 2018 

In this blog post I share my interview preparation process that helped me land offers from Google, Facebook, Uber and Amazon.

I describe how I prepared for different parts of the interview process, as well as share my philosophy on the interviews in general. Lastly, there are a lot of somewhat ad hoc links to some useful material throughout the article.

Text turned out to be pretty long, but reading it may be the easiest part of your preparation. So, get used :) Hope you will find it useful!

Table of Contents

  1. Premise
  2. Timeline
  3. Motivation
  4. Interview process
  5. Meta
  6. Books
  7. Coding interviews
  8. Distributed computing problems
  9. System design interviews
  10. Behavioral interviews
  11. Mock interviews
  12. Applying to companies
  13. Offers, negotiations and beyond
  14. Misc

Premise

Your interview experience may differ greatly depending on your background. Therefore, in order for you to find this guide more useful, I think it's necessary to share my background as it was at the time of applying.

First, I am a software engineer with more focus on the backend. Non-engineers have a completely different interview process. Frontend/ML/data/systems/mobile engineers have interviews which are fundamentally similar (after all, they also need to be able to code and know algorithms), but may have some parts that are specific to their role or otherwise different.

At the moment of writing, I live in the San Francisco Bay Area, part of which is often also called Silicon Valley. I applied only to the big and well-known tech companies, and all of them have offices here. Tech market is generally booming now, engineers are in high demand and well-paid, and it's pretty easy to find a job.

I am from Kazakhstan, and I am here in the United States on the work visa. Getting a work visa is hard, and this topic is well beyond this article (for a brief overview, read this piece), but the information here should generally work for most tech companies worldwide.

I have a bachelors degree in computer science from Nazarbayev University in Kazakhstan.

Before this round of applying to the companies, I had about 1.5 years of industry experience total. I was working for a smaller company ipsy, where I had a chance to work on a lot of cool tech stuff and got exposure to big systems at scale.

I have a lot of experience participating in programming contests, and my team got to the finals of ACM ICPC twice. So, I am pretty used to solving algorithmic problems, and before my interview preparation I generally already knew all the algorithms and data structures required to pass interview rounds.

I have a lot of friends in different big tech companies and startups. Their advice, help and experience definitely have been crucial to me. Thank you, guys! :)

Timeline

Before my onsite rounds, I intensively prepared for the interviews for about three months. On average, I worked on this about three hours a day, every day, so it's about 300 hours in total (I also worked fulltime during this time). In case you need to catch up on more or less material, you may need a different amount of time, but I think at least 200-400 hours during 2-4 months is a must first time you go through the hard interview process for a fulltime position.

Be also prepared that getting referrals, talking to recruiters, passing phone screens and onsite rounds, and getting and choosing offers will take some time, about 1-2 months. So you may want to plan accordingly and start contacting the companies earlier.

Motivation

Of course, investing at least three hours a day for several months into something is not easy, so here are some strategies that helped me:

  • Keep a log where you track how you prepare for interviews every day. I logged 98 days of my own preparation. Log not only helps you build a habit, it will also help later in reviewing the material you studied. For keeping a log I recommend Quiver - an Evernote alternative for programmers.
  • Read Deep work.
  • Quit social media.
  • Having a friend who is also preparing or passed interviews recently to discuss your progress with him/her definitely helps.
  • Make it your top priority. During my preparation, I didn't travel, rarely hung out with friends and ignored most of "important" errands.
  • Also, set yourself a deadline, something like "I will prepare for three months, and then apply". Not meeting a deadline is better than having no deadlines at all.
  • Read a chapter or two in Coders at Work for an inspiration.

Interview process

Good news: the interview process in most big tech companies is pretty similar, and you already may know all about it. But just to refresh your memory again, check out these materials on the format and structure of the interviews:

Meta

Some other guides and articles that I found useful:

Books

If you have time, I strongly recommend reading these books to get a deeper understanding of certain software engineering topics. I've read about 60% of their total content, full books in some cases and just several interesting chapters in others, and I feel it helped me a lot.

  • Effective Java – best book on Java, and I would recommend reading it even if you mostly use some other language.
  • Designing Data-Intensive Applications – a very good overview of the big distributed systems, and one of the best technical books I've ever read.
  • Clean Code – classic book on writing a good code.
  • Building Microservices – good book on microservices (without any unnecessary hype around them) that also provides a good overview of topics of security, testing, deployment and others.
  • Design Patterns by Gang of Four – classic book on design patterns. If you don't read all of it, make sure to at least know the following patterns: Singleton, Builder, Observer, Decorator, Facade.
  • Cracking the Coding Interview – I've read just several interesting chapters from there, but it's still a solid book about interview preparation in particular.
  • Modern Operating Systems – some chapters in this book provide a nice overview of hardware, memory management and other systems related concepts.
  • Learning PHP, MySQL & JavaScript – this book, which you can just skim in one evening, surprisingly provides a good overview of many important web concepts.
  • Coders at Work – book of motivating interviews with great programmers.

Coding interviews

Software engineer's interviews usually consist of coding, system design and behavioral rounds. Coding rounds, though, take at least 80% of the process, and by far are the most important. At these rounds you will typically get 1-2 algorithmic problems that you will need to solve in the language of your choice in about 45-60 minutes.

  • For practicing solving problems there is nothing better than Leetcode. It's so good that I feel anybody who solves 300-400 problems there will get a fair chance of clearing almost any interview round.
    • Leetcode has a lot of problems that are asked at the real interviews in big companies. By my estimations, about 25-30% of the problems I was asked to solve during the real interviews I solved on Leetcode before, and about 70% of the problems I was asked have something very similar there.
    • There is also a premium subscription for Leetcode that opens you more problems and features. I found it only somewhat helpful (mostly "problem frequency" feature and company problems lists), so it's up to you if you want to buy it or not. As another bonus, paying for the Leetcode subscription can be an additional motivation to solve it more ;)
    • Problem difficulties are not always very accurate, so don't skip easy problems. Hard problems, on the other hand, may be too tedious and intimidating, so get to them only once you are comfortable, and mix them with easier problems as well. Before my onsite rounds, I solved 333 Leetcode problems (115 easy, 160 medium, 58 hard), including ~100 that I solved several years before.
    • For choosing what to solve next, I recommend filtering problems by company tags (choose companies you want to apply to) and frequency. I also solved all problems from these collections and found them to be very helpful: top facebook questions, top google questions and top interview questions.
    • I participated in nine Leetcode contests and managed to reach 24th global rank before my onsites. Contests may be helpful to train your speed, but it's important to watch out for your solutions' code quality – you should write very clean code in your real interviews.
    • After solving the problem, be sure to check its discussion and some of the top solutions there. This will help you to learn about any better ways to solve the problem, and also you may find some good code examples for the language of your choice. Generally, at the interviews companies expect you to know at least one language very well, and write real code (not pseudocode) even on a whiteboard.
    • Avoid using IDEs and solve the problems right in the editor on the Leetcode website or on a whiteboard. This will better simulate a real interview environment.
  • Cracking the Coding Interview book has a nice collection of problems, though nowadays it's not as useful as Leetcode, where you can compile and test your solution. I mostly just checked the chapters I found interesting to me (for example, I recommend chapters about linked lists and trees).
  • During phone interviews you will code in some kind of a web editor while talking with the interviewer on a phone/skype, and on onsite interviews you mostly will code on the whiteboard. Writing a code on a whiteboard is pretty different from coding on the computer, therefore it's important to actually buy a whiteboard and solve more and more problems on it closer you get to the onsites. I got this one, and recommend getting at least this size or bigger.
  • This will probably be covered by 300-400 problems at Leetcode, but here is a list of algorithms and techniques you absolutely need to know: time and space complexity, sorting (quicksort, mergesort), binary search, hashmaps, trees, graphs, BFS/DFS, union find, tries, bit manipulation, stacks/queues, dynamic programming, priority queue, two pointers, recursion/backtracking, greedy solutions. Knowing this may also help: string hashing (Rabin-Karp algorithm), probability/combinatorics, segment tree, binary indexed tree (Fenwick Tree).
  • Note for those who are coming from competitive programming world: interview questions are a bit different than programming competitions problems. For example, in interview problems you may find restrictions that are pretty rare in CP world, like don't use division, don't use extra memory at all, or try solving the problem without using some particular algorithm. Also, code style expected in interviews is much cleaner and more structured than typical competitive programming code. Therefore even if you are pretty good with algorithms and solving competitive programming problems, I'd suggest still solving some Leetcode problems to get used to the format and prepare better.

    On the other hand, interview problems are much easier :)

Distributed computing problems

Some companies, especially Google, like to ask follow up problems that involve distributed computing – basically the same algorithmic problems, but you need to try to solve them using multiple cores/machines. I still don't know any good thorough source on this (ping me if you know?), but here is some material that I used for preparation:

  • Cormen has a nice chapter on parallel computing.
  • Some links that discuss certain distributed algorithm problems: 1, 2.
  • Learn about MapReduce paradigm and Spark framework.

System design interviews

In system design interviews, you are usually given a very vague design problem (like design Twitter), and you need to share your approach in about 45 minutes. The purpose of this interview is to test your experience working with real software systems, and how much you know about these systems in general. Usually, interns and new grads don't get this type of interviews, but otherwise you may expect it at every big tech company.

Here is a list of material you absolutely need to check:

Here are some videos that I found helpful:

I think one of the best ways to prepare for system design interviews is to expose yourself to as much information about designs of the real systems as possible, so here are lots of links to the blog posts, articles, videos and papers I found useful:

Behavioral interviews

In behavioral interviews, you will typically get asked questions like "What is the most challenging project you worked on?" or "What was your biggest failure during the time at the company X?", but this differs from company to company. At some companies, you may also get these questions asked during the usual coding interview rounds.

It's pretty hard to effectively prepare for this type of interview, but here are some guidelines and materials that will help:

Mock interviews

Real interviews are a pretty unique experience: you have to solve tough algorithmic problems in a limited time with somebody looking how you do it and with you explaining every step aloud. It may be confusing even if you are already a good coder, and this skill requires practice.

The best way to practice this without the risk of failing to get to the company of your dream is doing mock interviews. In these interviews you solve real interview problems in the setting as close to the real thing as possible. Here are the ways how you can do it:

  • Practice with friends. I did two mock interviews with friends and found both sessions very helpful. The downside of this approach is that you know your "interviewer" in advance, and, as a result, you are not as nervous as you may be on the real interview.
  • Pramp offers free mock interviews with peers, where you interview somebody over the internet for half an hour, and then they interview you. I did four mock interviews on the website, and found some of them to be pretty useful. On the downside, session quality heavily depends on your peer and the problem website chooses for you, and often the experience can be not that good. I also didn't really want to spend the time to interview people. During my time at ipsy I interviewed dozens of people, but if you never did this, I strongly suggest you trying Pramp – taking the side of the interviewer is a valuable experience.
  • For best mock interview experience, I strongly suggest gainlo.co. On this website, you arrange paid mock interviews with real engineers from Google, Facebook and other companies. Mock interviews are pretty expensive, but well worth it (partially because when you pay a lot of money for a mock interview, you treat it very seriously).
    I did four sessions: three with Googlers and one with Facebooker. Three interviews were coding ones, and one was system design. Mocks were awesome in three cases out of four, and these sessions really helped me to prepare better for the real interviews. One session, unfortunately, was quite mediocre.

Applying to companies

Applying to the companies is an art of its own. Remember that the whole interview process will take some time, so I suggest starting to reach out to the companies earlier. Here are some more additional points on this process:

  • Since preparing for the interviews is a big investment of your time and energy, it totally makes sense to apply to many companies at the same time. This way you have more chances that you will succeed, and with multiple offers at hand you can also negotiate a better compensation.
  • Best way to apply to the companies is through referrals from somebody who already works there. So reach out to your friends and friends of friends!
  • I solved all of Dropbox challenges at Codesignal (former Codefights), and within two weeks got contacted by 4-5 companies, including Twitter and Evernote. You may also try this.
  • Keep your LinkedIn updated. It is a good way to get contacted by the recruiters.
  • Don't stress out about resume too much. Read a chapter about resume in Cracking the Coding Interview, and check out this link on Careercup. Here is a Google Docs resume template that me and several of my friends successfully used to apply to the big tech companies – you can make a copy to create your own similar one! :)

You should also research the companies you apply to. Apart from Google and Wikipedia, here are some helpful links:

  • Glassdoor is a platform with employee reviews and other details for different companies.
  • Blind is an app and website where employees anonymously discuss their companies and a wide variety of other topics.

I also found that applying to the companies depends on your level of experience:

  • Students and new grads usually can apply only to internships and new grad positions respectively.
  • People with 3-5+ years of experience usually can easily get interviews almost anywhere.
  • Most of the positions require 3+ years of experience to apply for them, so with 1-2 years of experience (like in my case), the choice is somewhat limited and it may be harder to get interviews, especially with smaller companies.

Offers, negotiations and beyond

Here are some resources that will help you better navigate and negotiate different company offers. Remember that they want to hire you as much or even more as you want to get hired! :)

Misc

  • For phone screens make sure you have a reliable internet and phone connection, good headphones with a microphone, and a quiet place where you can be alone for the whole time. I also found that the best time for me to do phone screens is the first thing in the morning (after some breakfast of course). Interviews are a pretty nervous experience so you want to make yourself as comfortable and relaxed as you can.
  • Onsite interviews are physically and psychologically demanding, so you should take at least one rest day before and between them. I'd suggest taking something like one-two weeks off specifically to do onsites, and not doing more than three of them per week.