
Welcome to a course built from my interview experience, designed to guide you through the coding interview cycle, whether you’re fresh out of college or a seasoned professional.
Explore three interview questions per section, code and run solutions, and analyze complexity, covering strings and arrays, linked lists, sacks and qs, recursion, and heaps.
Choose the comfortable solution to explain, ask clarifying questions about input, output, and restrictions, start with a small base case, discuss time and space tradeoffs, and maintain a positive attitude.
Sharpen problem-solving with paper and pen, avoiding platform-specific concerns, since most interviews, including Google, are on a whiteboard; perseverance and clear solutions are emphasized.
Prepare for the interview by knowing expected question types and how to answer them, and discuss time complexity with your interviewer, even if you haven't solved it.
Merge two sorted arrays into a new sorted array containing all integers, given that all input arrays are sorted, with an example and advice to sketch a solution before continuing.
Set up two arrays and a merge object to combine them with two pointers, compare values, and append the smaller to the result, then print the merged array.
Analyze the time and space complexity of merging two arrays, including equal and unequal lengths and how duplicates affect storage, while noting printing isn't counted.
Learn to reverse a sentence by printing its characters in reverse, exploring approaches such as a result array, a stack, or recursion, and practice before the next section.
Implement a reverse sentence solution by applying a reverse function to a sentence object, iterating from the input end, filling a character array, and printing the reversed result.
Explain the time complexity of a function that loops through an array, sorts characters, and prints them, noting linear time, and compare a stack-based reverse output with another method.
Explore the max difference problem, also known as the max profit problem, by analyzing a stock price sequence to determine the best day to buy and sell for maximum profit.
Explore max difference concepts by tracking the minimum value and maximum profit while traversing an array, with helper functions for min, max, and print result.
Explore the max difference solution using helper functions to compare A and B, compute the minimum, and print the result with the last position.
Examine how iterating through every element once and using intermediate helper values yields O(n) time, avoiding O(n^2) comparisons.
Reverse a linked list and compare approaches to show understanding. Use a three-value example to illustrate the reversed output and note the tail is lost.
Reverse a linked list by iterating with previous and current pointers and reassigning next links. Update the head to the final node and print the reversed list.
Analyze the time complexity of reversing a linked list by iterating through each element, showing linear time behavior.
Learn to find the kth last element in a linked list and remove it, illustrated with A B C D and k = 3, yielding A B D.
Remove the kth node from a linked list using a two-pointer approach, advancing the second pointer k places ahead and re-linking the first pointer to delete the target.
Perform a quick complexity analysis as you traverse the array with a two-pointer technique until the end. Identify linear time complexity.
Detect cycles in a linked list using two pointers, identifying the node where the cycle begins and distinguishing non-cyclic lists that terminate at nil.
Coding Interview Bootcamp's lecture implements a linked list with a cycle and uses slow and fast pointers to detect the cycle and identify the looping node.
Assess time complexity by counting an end number of operations proportional to n, yielding linear time complexity for a list of length n.
Introduce the eight queens problem on an eight by eight board, placing eight non-attacking queens, and explore a recursive solution with four by four example and pen and paper practice.
Instantiate the queen's class and invoke a recursive solve to place eight queens, using a base condition, valid moves, and backtracking to print the board.
Build a backtracking solution for the eight queens puzzle by implementing valid_move to check rows, columns, and diagonals on the board.
Explore the eight queens backtracking solution and its time complexity: nested loops yield O(n^2), move checks add O(n) for O(n^3), with notes of exponential O(2^n) in some cases.
Explore combinatorics by generating all permutations of a string, like ABC, with a recursive approach. Sketch a recursive solution before continuing.
Build a recursive string permutation solver. Use a constructor to set the start length, call solve, and generate all full-length permutations by inserting the prefix at every location in substrings.
Examine the time complexity of calculating all the possible permutations of a string, which is factorial; use a three-character example to show six permutations.
Explore Towers of Hanoi using recursion to move a stack of disks from a source to a destination via a spare tower, starting with the single-disk base case.
Initialize a three-tower hanoi setup with five disks on tower 1; solve recursively using a spare, then move disks to the destination and print results.
Implement the add function to place a disk on a tower, handling empty towers and top-disk checks. Print each tower's contents to show the Hanoi towers in final state.
Explore the exponential time complexity of the Towers of Hanoi with a recursive solution described by T(n) = 2T(n-1) + 1, including the base case T(1) = 1 and disk moves via a spare tower.
Explore common tree data structures: binary trees and binary search trees with left and right rules, red-black self-balancing trees that keep search fast, and heaps, max and min heaps.
Breadth-first search traverses a tree level by level, visiting all nodes at each level. It powers shortest-path queries, such as Google Maps directions, and supports social networks and web crawlers.
Define a tree node class with an integer value, left and right children, and a visited flag; provide a constructor and a function to return children, and build a tree.
Demonstrates an iterative breadth-first search using a queue to traverse a tree level by level, starting at the root, visiting and printing nodes, and enqueuing unvisited children.
Visualizes a tree traversal from the root to its children, showing root-first then level-by-level progress as the basis of breadth first search, with a note on pre order traversal.
Explore the depth first search algorithm, its in-order traversal visiting left subtree, then the parent, then the right subtree, and its use in family trees, mazes, and decision trees.
Implement depth first search on a binary tree by building a small tree and running both iterative (stack-based) and recursive preorder traversals, then verify consistent outputs.
Explore depth first search analysis by comparing in-order, pre-order, and post-order traversals. Learn how root, left, and right subtrees are visited and how to adjust recursion order for each traversal.
Explore red-black trees, a balanced binary tree with red or black nodes; learn the rules, black height, and how insertion rebalances via recoloring to ensure log-time search.
Explore red-black trees, a self-balancing structure that guarantees efficient search time. See their use in Linux kernel scheduler and in C++ map and set, Java tree map and tree set.
Celebrate your course completion and harness momentum for your next interview. Apply general interview tips and pearls of wisdom to guide your interviewing journey.
Persevere in your interview journey and stay motivated as you pursue the job of your dreams. Reach out with questions or feedback, and happy interviewing.
Who This Class is For
The ideal student for this course is someone who wants a comprehensive and easy to follow guide in preparing for coding interviews. They can be someone who's completely new to coding interviews (ie new grad, or someone going through a career change), or someone who hasn't done them in a while and wants to brush up for an upcoming interview.
What You Will Achieve at the End of this Class
What I hope to achieve with you at the end of the class is a better awareness and preparedness of what questions tech companies ask, and how to prepare for those questions. Even if the question isn't exactly the same, you'll recognize the pattern, and be able to start solving and speaking intelligently to the problem.
Steps for the Rest of the Class
Every coding interview I've done (with a few exceptions) has included whiteboarding. If you're coding remotely, it'll most likely be a word document with no compiler. There are some companies that will provide a platform that runs test cases through your program. This class is intended for the majority of companies that still whiteboard.
Therefore, it's smart to use pen(pencil) and paper to follow along with the lectures as I type and make your own notes. Try to solve the problem on your own before you look at the solution, and then compare your solution to mine. How do they differ and why? Each problem set will include a problem statement, a strategy for solving, a solution, and Big O complexity analysis (how efficient is our solution?) Go over the sections that you don't understand, because it will make you feel more confident.