4 - Coding Interview
Authors: Stefano Ivancich
Use LEETCODE.
WHY LEETCODE IS BETTER than other (free) platforms (as 2025):
- Problems were almost all asked in real interviews. No competitive programming o theoretical problems.
- Most of the problems have fully explained solutions.
- For each problem there is a well-organized sub-section with a very active community.
- Hackerrank, codility, … have too long problem statements or don’t have clear solutions.
- Codeforces, Codechef, kattis, … are for competitive programming.
- Most of the problems (probably all) on books like CTCI and EPI are on Leetcode. (Use those books just to learn the theory, don’t waste time on doing problem on paper, search them on leetcode)
Leetcode alternatives:
- Hackerrank (used also for online assessment, contains also other programming topics)
- Codesignal (used also for online assessment)
- Codility (used also for online assessment)
- HireVue (used for online assessment)
- Codingninjas (dsa guided path, mock interview, competitive programming)
- CodeForces (Competitive programming)
- Kattis (Competitive programming)
- UsacoGuide (Competitive programming)
How to prepare:
- Read the first 86 pages of CTCI that explains how interviews works.
- Watch a couple of videos on YouTube “Google coding interview” to get familiar with the context of coding interviews. (Do not watch too old videos, the interviews slightly change over time). Example
- For each chapter of CTCI read the 2-3 theory pages (or theory here) then do exercises on the respective neetcode.io/roadmap or leetcode.com/explore/learn/ section. Here there is a list of theory topics with explaniations.
- Then do problems on the problem sets (Neetcode, Grind75, Easy, Medium, Hard, Blind75, Google, …).
- Do mock interviews on (pramp.com) or with friends
- (Optional) Learn more theory on books: Goodrich (in Python, Java or C++), Competitive Programming Handbook, Cormen, CP4.
- (Optional) If you want to spend money for learning the theory (not really needed), we suggest the following courses: Leetcode DS&A crash course, Neetcode DSA for beginners, Neetcode Advanced
General advices:
- Do problems on topics that you struggle at. Is not useful to do problems on topics you are already good at.
- Do problems slightly above your level.
- Be constant: Solve at least ONE problem a day. (Do something like Leetcode Daily challenge)
- If a problem has too many dislikes, carefully read the problem statement and comments before solving it to avoid wasting time in useless or too harsh problem.
- Once you solved the problem, look at the discussion section and read other people solutions.
- Easy problems are too easy. On the long run try to solve mostly mediums and hard.
- Use a timer. Leetcode has an embedded timer.
- Do problems on the interview lists of the company you want to join more than once.
- Participate in Leetcode contests to become comfortable solving problems under pressure.
- Do a mock interview AT LEAST once a week and recreate as much as possible the interview environment (clothing, light, papers, materials, whiteboard, …) to become comfortable.
- Use just 1 or 2 platforms to prepare, otherwise you will end up doing all easy problems in a platform, change to another platform, do all the easy problems, then switch again and so on. You will end up doing just easy problems. Do a couple of problems on other platforms just to become comfortable with the platform that is going to be used for online assessment (e.g. hackerrank, codility, Codesignal) and interviews (e.g. hirevue, coderpad).
- Write down the most interesting problems and techniques that you encounter. In general, medium problems are a composition of easy problems/techniques and hard problems are composition of medium problems/techniques.
- Do yourself a favor and take notes of the topics you are studying. During this time, you will be covering so many different subjects and tricks, and being a human being guarantees that you will forget the majority of them, so take notes and review them once in a while. Your notes are also a valuable resource for the next time that you are preparing for the interviews.
- If you cannot solve a problem:
- Spend no more than 20-30 minutes without making progress. Just go look up the answer. Contrary to popular belief, most struggling past 30 minutes is pointless.
- Read just a little part of the solution and try to go on yourself. If you struggle, read a little bit more and so on, until you really cannot solve yourself.
- Always implement it yourself, don’t just read the solution and copy and paste the code.
- Always mark it as something you need to try again. Wait at least a day and try to solve it fresh. If you fail, repeat at infinitum.
To be prepared Aim to do:
- >300 leetcodes with ratio easy:medium:hard of 3:5:2 (~100E,150M, 50H)
- Be able to solve: easy in <10m. Medium <20m. Hard <30m.
- 20+ mock interview
- 15 coding
- 5 behavioral
Important Problem Sets TO DO:
Other problem sets:
- Leetcode Interview Easy Collection
- Leetcode Interview Medium Collection
- Leetcode Interview Hard Collection
- BLIND75
- Leetcode Patterns
- Leetcode Curated Algo 170 (Premium)
- Leetcode Explore -> Interview -> Specific company Collection (Premium)
- Leetcode Mock Interview online assessment, phone, … (Premium)
- Leetcode Discussion: Microsoft-Online-Assessment-Questions
- Leetcode Discussion: Google-Online-Assessment-Questions
- Leetcode Discussion: Amazon-Online-Assessment-Questions
- Dynamic Programing
- CSES problem set (Competitive programming)
Where to get Mock Interviews:
- Our SuperHerovalley community: there are already more then 100 Italians that got a big tech offer and are willing to interview you for free !
- pramp.com (completely free, also for behavioral, system design, frontend, and so on): you can choose whatever time/day you want, they will find another person to match with you.
- interviewing.io (PAID) - YouTube Channel
- Short Introduction (5 min):
- “Tell me about yourself”
- “Tell me about a project that was very challenging for you” (or some sort of variation of this"
- Here you can learn how you answer to this
- Technical Assessment (30/45 min): you will get one or 2 coding problems, each will have follow ups
- Closing questions (5 min): you have the chance to ask questions/curiosities about the company
- DO NOT ask questions that could be found easily online like How is working for company-X? What’s the thing you enjoy the most about company-X? How is the food at company-X’s canteen? …
- Ask somethinkg that can be helpful for you when you will be inside, for example:
- How to perform as an intern? What are the common mistakes intern makes?
- What is the best way to onboard fast to this type of company?
- How many times a year and how the performance review works?
- Clarify the problem (5 min): most of the times, especially for more senior position, the will give you a problem with ambiguity, with missing and wrong information.
- Ask at least 2 clarifying questions even if the problem is already clear.
- Write down all the problem informations
- State a couple of examples to confirm you understood the problem correctly, and restate the problem statement to the interviewer to be sure.
- (Iterative) Design Phase (5-10 min):
- Write down in pseudocode a BruteForce idea while you speak and explain clearly your thought process to the interviewer.
- State time and space complexities
- Ask the interviewer if you can have another couple of minutes to think about a possible optimization or if he wants you to start coding.
- Write down in pseudocode possible bottlenecks and alternative ideas, always explaining your thought process.
- Write down in psuedocode the optimized solution
- Ask the interviewer if you can start coding.
- Coding Phase (5-10 min): After you agreed together with the interviewer on a design choice, it is time to code it!. Always Tell what you are typing in and why.
- write good meanungful variable names
- structure the code in clear functions
- Testing & Bug fixing (5-10 min):
- Be able to proof-read your code to find bugs without running the code. Dry run your code (by hand!) with some example inputs and outputs.
- State a list of possible edgecases
- Write down edge cases in a tabular way
- Run the code
- Follow ups:
- There will be follow up questions making the problem harder
- Do not remove or modify the code, but copy and paste it in a different funcion. You don’t want to lose a working solution
- There could be general software engineering questions like: how would you parallelize this code?, How multiprocessing works in X language? How would you test this code in unit/integration tests? What if the input is very large and cannot fit in a single machine?
"""
# PROBLEM INFO
- array of integers
- integer k
- bla bla
Constrains:
- only 0s and 1s
- integer k is at most 1000
- blabla
Problem: find a value x such that bla bla bla
# EXAMPLES
Only zeros
[ 0 0 0 0 0]
solution is 5...
Even numbers of element
[....]
# EDGE CASES
- Empty array
- only ones
- bla bla
# BRUE FORCE SOLUTION
Idea: 2 nested for loops
for each element: O(n)
for each ...: O(n)
if x>b: do this
count all possible bal bla O(n)
Time: O(n^3)
Space: O(1) no extra space needed
# Optimiziation
Idea: use a stack and binary search
bla bla bla pseudocode
Time:...
Space: ...
"""
STUDY PLANS:
- Tech Interview HandBook (GitHub): hints, resource material and links to problems for interview preparation
- InterviewBit Preparation: good study plan with various arguments
- Leetcode Study Plans
THEORY (WEBSITES):
- Algorithms for Competitive Programming
- Coding Interview University
- 14 Patterns to Ace Any Coding Interview Question
- 25 Patterns you must know
- Grokking the coding interview (PAID)
THEORY (BOOKS)
- Cracking the Coding Interview (Laakmann McDowell)*
(GitHub repo problems: https://github.com/careercup/CtCI-6th-Edition) - Grokking Algorithms (Aditya Bhargava)*
(GitHub repo problems: https://github.com/egonschiele/grokking_algorithms) - Introduction to Algorithms (Cormen)
- The Algorithm Design Manual (Skiena)
- Competitive Programming Handbook
- Elements of Programming Interview
- Software Engineering at Google
THEORY (VIDEO)
- Interview Prep mini-course by Google
- Data Structures Easy to Advanced Course
- Intro to Algorithm (MIT Course)
- Algorithms playlist
- Back To Back SWE Youtube channel Best coding Youtuber (Remo)
(Fork with solutions: https://github.com/SuperheroesValley/backtobackswe) - 5-hours, hands-on course on Dynamic Programming
- 5 Simple Steps for Solving Dynamic Programming Problems
- Google Students Virtual Series: Build for Everyone
PRACTICAL:
- BLIND75 Top 75 LeetCode Questions to Save Your Time
- Grind75* (Leetcode study plan from Blind75 author)
- Neetcode.io* (Blind75 + Video solutions)
- Sean Prashad List: Leetcode recommended problem list (filtered by tag/difficulty/company/pattern)
- Leetcode solutions for Meta
- Time Complexities in Python
COMMUNITY-MADE
- Overview of Bit Manipulation and Rolling Hash, with excercises and solutions: by Antonio Strippoli
- Algorithms for coding interviews by Stefano Ivancich
- Hare-Tortoise algorithm: by Riccardo Mori
- Superhero Valley Excercises Repository: Superhero Valley’s solutions to InterviewBit and Leetcode problems
[*] Recommended!