Interview study to reinforces basic software engineering skills.
Technical Phone Interview Preparation
Technical Interview Study Plan
- I didn't solve hard problems at all. I solved around 400 medium problems and all easy problems on LeetCode. It's better to understand the approaches used and learn to come up with the solution yourself, instead of looking up the answer.
- Don't look the answer at all. If you can't solve the problem in an hour, even with drawing on a notebook with a pen, just skip the question. Don't look the answer. Go back to this question in two weeks and try another hour. If you still can't solve it - try to find a hint, if there's not hints, then lookup the answer. Review this question in a month or so.
- Practice your weak topics.
- You'll most likely asked a hard problem on the interview. But solving many Medium LC questions will help you much more. There are many Medium problems that are harder than the Hard ones.
- Don't run after numbers. It doesn't matter if you solved 100, 200, or 1000 problems. All that important is the quality. If you solved 200 problems, but you looked the answers for half of them, I bet you won't be able to come up with a solution to a problem you saw 3-4 weeks ago. Which means, your brain will work like a Queue.
- Quality > Quantity.
- Good luck.
You should be able to crack a decent amount of hard LCs, that being said, Google focuses pretty heavily on breadth. So be sure to practice extensively on:
backtracking(appears very often)
dynamic programming
graphs (dfs, bfs, union find [usually asked as a follow up question to optimize a purely dfs/bfs approach], dijkstra)
two pointers (very often)
binary search (very very often) I've noticed somewhat of a new trend at Google, namely binary search on monotonic functions, i.e. : https://leetcode.com/problems/split-array-largest-sum/.
Several others have mentioned getting interviews on this kind of problem, and you're pretty much gonna be able to come up with a solution instantly if you map it to binary search on sight.
- Google Tech Dev Guide
- Geeks for Geeks - Company preparation
- Geeks for Geeks - Google interview preparation
Complexity - Time and Space
Practice Your Code
Lectures and Tutorial and Guides
- Google For Education - Python
- Hacker Earth Practice
- Python Quick Tutorials
- Hacker Earth - Bit Manipulation
- MIT 6.006 Introduction to Algorithms, Fall 2011
- To Do: watch the dynamic programming videos
Python Topics
Python - Deep copy vs shallow copy
Python - When to use
Python - Integers
Python - List
Python - Dictionary
Python - Typing Annotations
Textbook Resources
- Online text: Algorithms by Jeff Erickson
- Online text: Introduction to Programming in Python by Robert Sedgewick and Kevin Wayne
- Online text: Algorithms, 4th Java Edition by Robert Sedgewick and Kevin Wayne
- Introduction to Algorithms, Third Edition by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein.
- The Algorithm Design Manual by Second Edition by Steven S. Skiena.
- Programming Pearls, Second Edition by Jon Bentley
- Data Structures and Algorithm Analysis in Java, Third Edition by Mark Allen Weiss.
- Data Structures and Algorithms with Python, Springer Press, by Kent D. Lee and Steve Hubbard
- Python Algorithms - Mastering Basic Algorithms in the Python Language, Second Edition by Magnus Lie Hetland
Binary Tree
Heap
- Binary Heap
- n = len(array)
- last parent = ((n - 1) - 1)//2
- parent index given i: parent = (i-1)//2
- index of left child = 2 * parent + 1
- index of right child = 2 * parent + 2
- where 0 <= i < n
from typing import List
def swap_min_value(array: List, parent, index):
n = len(array)
if index < n and array[parent] > array[index]:
array[parent], array[index] = array[index], array[parent]
def min_heapify(array: List):
n = len(array)
last = n - 1
# Last parent index
parent = (last - 1) // 2
while parent > 0:
left, right = 2 * parent + 1, 2 * parent + 2
swap_min_value(array, parent, left)
swap_min_value(array, parent, right)
parent -= 1
Mergesort
Heapsort
-
To sort elements in ascending order:
start i = 0 while i less than n-1 build max heap from i=0 to n-1-i swap 0 and n-1-i element in order to put the max element at n-1-i index
-
To sort elements in descending order:
start i = 0 while i less than n-1 build min heap from i=0 to n-1-i swap 0 and n-1-i element in order to put the min element at n-1-i index
Google Tech Dev Guide
LeetCode Articles
LeetCode
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Maximum sliding window |
algoexpert.io - 70 Questions
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Two number sums | Easy | .py | O(n) | O(n) | |
Three number sums | Medium | .py | O(n^2) | O(n) |
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Construction of a double linked list | Easy | .py | |||
Remove Kth Node from End | Medium | .py | O(n) | O(1) |
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Caesar Cipher | Easy | .py | .py | O(n) | O(1) |
Largest palindrome substring | Medium | .py | .py | O(n^2) | O(1) |
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Largest three numbers | Easy | .py | .py | O(n) | O(1) |
Binary search value | Easy | .py | .py | O(log n) | O(1) |
Problem | Difficulty | Solution | Test | Time Complexity | Space Complexity |
---|---|---|---|---|---|
Bubble Sort | Easy | .py | .py | O(n^2) | O(1) |
Insertion Sort | Easy | .py | .py | O(n^2) | O(1) |
Selection Sort | Easy | .py | .py | O(n^2) | O(1) |