
Tackle 10 popular coding interview problems spanning key algorithms and structural topics to boost knowledge and prepare for interviews.
Check if two strings are anagrams by counting character frequencies with hash tables and comparing, or by sorting both strings and comparing; discuss time and space complexity.
Find the first and last positions of a target in a sorted array using linear scan and binary search. Learn about time and space complexity.
Explore three approaches to the kth largest element problem: remove the maximum k−1 times, sort the array, and use a heap-based priority queue, with notes on time and space trade-offs.
Solve the symmetric binary tree problem using a recursive depth-first approach that compares mirrored subtrees, handles base cases, and analyzes time and space complexity.
Solve the general parentheses problem with backtracking to generate all valid combinations of n pairs. Backtrack when branches become invalid and analyze time and space complexity.
Identify the unique start station in a circular gas station problem by comparing gas and costs, then apply an efficient O(n) solution that returns the valid start or -1.
Model prerequisites as a directed graph to decide if all courses can be finished, using topological sort with dfs or bfs to detect cycles and produce a valid ordering.
Compute the Keith permutation of numbers 1 to n without generating all permutations by using factorial-based indexing, selecting each next element from unused numbers and updating k.
Solve the minimum window substring problem to find the shortest substring of s that contains all characters of t, using sliding window and frequency counters, with optimized approach.
WARNING: The instructor is not currently available to answer questions regarding this course
Preparing for coding interviews? Competitive programming? Then this course will help you for sure: 10 well-chosen problems to increase your problem-solving skills!
Problems covered:
1- Valid anagram (Related topic(s): String, Sorting, Hash table)
2- First and last position in a sorted array (Related topic(s): Array, Searching, Binary search)
3- Symmetric tree (Related topic(s): Binary tree, Depth-first search)
4- Kth largest element in an array (Related topic(s): Array, Sorting, Priority queue, Heap)
5- Generate parentheses (Related topic(s): Backtracking, Stack)
6- Course schedule (Related topic(s): Graph, Depth-first search, Breadth-first search, Topological sort)
7- Kth permutation (Related topic(s): Combinatorics, Math)
8- Gas station (Related topic(s): Array, Greedy)
9- Minimum window substring (Related topic(s): String, Sliding window)
10- Largest rectangle in histogram (Related topic(s): Array, Stack, Divide-and-conquer)
This course tries to explain the solutions to these problems in a visual way, as visualizing the different steps of an algorithm is a method that is preferred by a lot of students
This course also explains and provides the code in Python programming language, you will also find it under each lecture to be able to copy it and run it on your machine with different inputs
Also, before moving to the solution, you will have the ability to try to solve the problem, a Python code editor will be available for you to write code and submit it to be tested on a bunch of testcases, I suggest you to do it before moving to the solution