
Meet the prerequisites with strong problem-solving skills, solid data structures and algorithms, and familiarity with C++ STL to master medium leetcode problems for coding interviews.
Learn how to use this course effectively to master problem solving for coding interviews. Focus on strategic practice, time management, and a blind-based sprint approach.
Center this course on C++ as the main language, with downloadable code for Java, C#, Python, and JavaScript to aid learning. Cover vectors, deque, unordered_map, unordered_set, loops, and operators.
Learn to brute force problems as a warm-up, understanding its pros, traps, and simple examples like password guessing, two-sum checks, and palindrome changes.
Analyze algorithm complexity by evaluating time and memory, with time complexity emphasized in interviews. Recursion adds auxiliary space on the stack, while iterative methods use constant space.
Tackle the two sum problem by exploring brute force, then optimize with a hash table to achieve O(n) time, while considering edge cases like duplicates and index validity.
Identify array problem patterns across range problems, two pointers, and ad hoc cases, using prefix sums, sliding windows, subarrays, substrings, hash tables, and min and binary search to optimize solutions.
Learn how prefix sums and suffix sums enable O(1) range queries, via DP recurrence and range cancellation, with non-negative inputs enabling binary search.
Update:
Someone updated me there is a LeetCode solution for this problem
The only code difference is the handling when you don’t find an answer: Return -1
Count sub-arrays with sum equal to k in an array, starting with brute-force windows and advancing to prefix-sum optimization to o(n^2). Build interview-ready strategies across language-agnostic examples.
Convert equal zeros and ones problem to a zero-sum window by treating zeros as minus ones, using a prefix-sum hash table to store earliest indices and maximize the subarray length.
Explore the fixed size sliding window technique to compute the maximum sum of K elements, contrasting with the prefix sum approach and using a running sum and boundary aware indexing.
Determine if duplicates exist within k positions in an array by using a sliding window with a hash set to track last k elements.
Master variable-size sliding windows by comparing nested-loop expansion and a single two-pointer approach to find subarrays or substrings, including maximum-sum subarrays, with efficient window expansion and validation.
Master a variable-size sliding window that expands the right end and shifts the left to keep at most K zeros, achieving an O(n) solution.
Explore the relationships between maximum and minimum subarrays, identify their possible containment or adjacency, and solve maximum absolute sum and circular subarray problems using prefix sums, duplication, and insights.
Master the two-pointers technique with left and right indices to solve sorted array problems, distinguishing it from sliding windows and achieving O(n) time and O(1) memory for target sums.
Explore solving the longest mountain subarray problem with a sliding window approach that detects a strict up sequence followed by a strict down sequence.
Solve the max area problem on an array of nonnegative integers by selecting i and j (i<j) to maximize min(A[i], A[j])*(j-i) with a two-pointer greedy shrink from the smaller side.
Extend the two-sum approach to the three-sum problem using a sorted array and two pointers to find unique triplets, while skipping duplicates and applying root cause analysis to duplicates.
Maintain the three largest and two smallest values with a min-heap and a max-heap for O(n) time and O(1) memory, and optimize brute-force using left and right max/min arrays.
Find the longest consecutive sequence in an unsorted array using a hash set. Start from numbers with no predecessor and extend to the next value for O(n) time.
Solve the missing number problem in an array from zero to n. Learn brute force, hash, sum, and xor approaches for linear time solutions.
Solve this easy string problem about anagrams by checking two strings s and t for identical character frequencies. Compare frequencies with hash tables for O(n) time or sort the strings for O(n log n), and consider canonical forms across lower and Unicode letters.
Learn isomorphic strings by enforcing bidirectional mappings with two hash tables, ensuring consistency in both directions, and compare brute-force with optimized approaches plus a canonical re-indexing method.
Explore solving the palindrome with at most one deletion by testing brute-force and recursive approaches, using left-right pointers, and a greedy observation to skip deletions when ends match.
Leverage the top-right starting point in a 2D sorted matrix to locate a target efficiently with a staircase search, achieving O(R+C) time by using both row and column order.
Explore in-place matrix rotation with O(1) memory by using permutation cycles to swap four cells at a time, comparing hard and easy approaches and highlighting cycle identification strategies.
Explore an in place matrix rotation by first transposing the matrix and then reflecting columns, using careful in place swaps to preserve data with O(1) extra memory.
Learn to solve 2D range sum queries on a matrix by building row-wise prefix sums with O(n^2) preprocessing, then answer each rectangle query in O(n) by summing row ranges.
Create a 2d image integral by applying row and column prefixes to enable constant-time rectangle sums, and note update rectangle challenges with 2d segment trees or 2d binary indexed trees.
Fix column pairs, compress between them into a 1d array with row sums, and solve non-empty 2d maximum sub-rectangle sum via the 1d maximum subarray approach in O(n^3), handling negatives.
Master the sparse matrix multiplication with a sparse-aware optimization that reorders loops and skips zeros, reducing from n^3 to near n^2 in large matrices.
Design a memory-efficient sparse matrix data structure to support incremental updates and multiplication, selecting representations based on operation frequency, and implement with simple test cases.
Design a sparse matrix using a double-view data structure with two hash-table layers for row and column entries. Implement add_cell and multiply to enable flexible transpose.
Learn to compute the largest histogram rectangle using left and right smaller indices (next smaller, previous smaller) and compare four strategies (prefix, sliding window, two-pointer, ad-hoc).
This lecture shows solving the maximal rectangle with column rearrangements by greedy sorting of per-row heights, then extends to maximal squares, flipping ones and zeros, plus editorial dp insights.
Analyze function log sequences to compute per-task execution times, excluding sub-call durations, using a stack-based approach for recursion. Parse logs into id, start, end events and accumulate timing with push-pop.
Master a stack-based approach to the longest valid parentheses substring, using an integer stack to link open expressions to their parents and accumulate lengths.
Welcome to one of the unique and special Coding Interviews courses.
This course is all about algorithmic problem-solving for problems mainly from the Leetcode website. Specifically, the medium level frequent interview problems. The goal of this course is to sharpen your problem-solving skills to aid you in ACEing Coding Interviews from FAANG companies. During the course, you won't only be provided with a problem and its solution, but a series of hints and thinking approaches to tackle the problems.
I don't teach data structures or algorithms in this course. You must study these courses from high-quality sources and solve many problems to gain basic problem-solving skills. The problems in this course are of medium level. Without proper background and skills, the materials will be hard to learn.
Part 1 content
Part one covers the data structures:
Arrays: Prefix Sum, Sliding Window (fixed and variable size) 2 Pointers, and Permutations.
Tutorials are provided for these topics only, as they are not covered in DSA courses.
String
Matrices
Stack and Priority Queue
Linked List and Binary Trees
Hash Tables
The scope of the topics: Interviews coverage.
Note: You are expected to solve the implementation problems over these topics during a data structure course. For example, reversing a linked list is a common interview question. I won't cover it. It is mainly an implementation task. The same for the basic binary tree DFS problems. I do cover such questions in my data structure and algorithms course. This course is about problem-solving challenges.
Although the focus of this part is Data Structures, but still your background in Algorithms is needed.
Major: Complexity, Recursion and Sorting
Minor: A few times I refer to: Binary Search, Divide and Conquer and Dynamic Programming
Generally, most of the problems require serious algorithmic skills
The course level:
Most of the problems in this course are Leetcode MEDIUM level, which represent 85-90% of real interview questions.
To be more effective, the questions are mainly the most frequent interview questions according to the LeetCode website.
This means; in addition to gaining problem-solving skills, you increase the chance of meeting problems you already solved in the interviews!
Without proper background & skills ⇒ the course will be hard to learn
Prerequisites:
Strong programming skills & DSA knowledge/skills (from 3 courses)
A high-quality programming course consisting of:
Good coverage for programming + many exercises on learned topics
Proper understanding/using for built-in algorithms/DS (e.g. C++ STL / Java Collections)
Optional: Several projects to be comfortable with long coding
A high-Quality Data Structure course: good coverage + many exercises
A high-Quality Algorithms course: good coverage + many exercises
This implies: you already solved and coded a lot. It is time to move to medium challenges.
Don't join this course if you lack basic problem-solving skills
The course programming language
All slides codes are based on C++
Mainly C++11. I intend to not use the very modern C++
Many people don't study after C++11
It will be easier for other programming languages to understand the code
C++ code is very similar to Java and C#. To a good extent, similar to JavaScript.
The LeetCode discussion tab has solutions for many other languages
80% of the problems: I will download solutions for some other languages (Python, Java) .
No promise, but some downloads for JavaScript and a few C#
As the code is downloaded, expect differences in the code structure. You must understand fully the lecture first.
The course natural language:
The course is only in English with an Egyptian accent
English subtitles are provided to make it easy in case. it is easy to adapt the Egyptian accent
Videos problem-solving cycle:
Presenting a problem
Verifying assumptions and test cases
Trying to brute-force the problem
Optimizing the brute force if possible
Or analyzing the problem and test cases
Several iterative hints are provided; a missing educational key in other resources
Well-written codes.
2 training styles are possible with the materials.
A topics-based style where you focus on a specific topic and solving many of its problems. This style has a great disadvantage; you know the solution category (e.g. a stack problem), which is a big hint.
A blind-based style where sprints of problems are provided. Each sprint is 10 problems to solve.
You don’t know the category of the problem.
This is a more matching experience to the real interviews experience.
This style is the recommended one.
After the course, you will be provided with more problems to solve on your own to keep enhancing your skills.
You must solve a lot to increase your chance of passing the interviews.
A problem name starts with
E for easy-level from 1 to 3
M for medium-level from 4 to 7
H for hard-level from 8 to 10
Acknowledgement: “I’d like to extend my gratitude towards Robert Bogan for his help with proofreading the slides for this course”