Meta

Alien Dictionary

Given a sorted dictionary of alien language, find the order of characters in the alien alphabet

All Paths From Source to Target

Find all possible paths from source node to target node in a directed acyclic graph (DAG)

Articulation Points (Cut Vertices)

Find all articulation points in an undirected graph - vertices whose removal increases the number of connected components

Bellman-Ford Algorithm

Find shortest paths from a source vertex to all other vertices in a weighted graph, capable of handling negative edge weights

BFS Shortest Path in Unweighted Graph (O(V+E))

Learn BFS shortest path in an unweighted graph: O(V+E) time, queue + parent[] for path reconstruction. Step-by-step for interviews—start now.

Breadth First Search (Shortest Reach)

Compute shortest distances from a start node in an undirected graph with uniform edge weight using BFS.

Check if Array is Sorted

Determine if an array is sorted in ascending, descending, or not sorted at all

Clone Graph

Create a deep copy of an undirected graph represented with adjacency lists

Connect Ropes with Minimum Cost

Connect ropes with minimum cost using greedy approach with heap

Course Schedule

Determine if you can finish all courses given prerequisite relationships using topological sorting

Depth-First Search (DFS)

Implement depth-first search traversal for graphs

Find Bridges in a Graph

Find all bridges (critical edges) in an undirected graph using Tarjan's algorithm

Find Duplicate Number

Find the duplicate number in an array containing n+1 integers where each integer is between 1 and n (inclusive)

Find K Largest Elements

Find the k largest elements from an unsorted array

Find K Smallest Elements

Find the k smallest elements from an unsorted array

Find Median from Data Stream

Design data structure to find median from continuous stream of integers

Find the Maximum Element in an Array

Find and return the largest element in an array of integers

Find the Second Largest Element in an Array

Find and return the second largest element in an array of integers

Floyd-Warshall Algorithm - All Pairs Shortest Path

Find shortest paths between all pairs of vertices in a weighted graph using dynamic programming

Furthest Building You Can Reach

Find furthest building reachable using optimal allocation of bricks and ladders

Implement Stack

Design and implement a stack data structure with push, pop, top, and empty operations

Is Graph Bipartite

Check if a graph can be colored with exactly two colors such that no two adjacent nodes have the same color

Kth Largest Element in Array

Find the kth largest element in an unsorted array

Kth Smallest Element in Sorted Matrix

Find kth smallest element in row and column sorted matrix using heap

Largest Rectangle in Histogram (LC 84): Monotonic Stack

Hard LC 84. Learn the O(n) monotonic stack (prev/next smaller) to compute max histogram area—step-by-step for FAANG interviews. Practice now.

LC 103 Zigzag Level Order Traversal (BFS) Guide

Solve binary tree zig zag/spiral traversal with optimal BFS + deque. O(n) time, O(w) space. Step-by-step for interviews—practice now.

Longest Palindromic Substring

Find the longest palindromic substring in a given string

Longest Substring Without Repeating Characters

Find the length of the longest substring without repeating characters

Maximize Sum After K Negations

Maximize array sum by flipping signs of k elements using greedy heap approach

Meeting Rooms II

Find minimum number of meeting rooms required using heap

Merge K Sorted Arrays

Merge k sorted arrays into one sorted array using heap

Merge Two Sorted Arrays (LC 88) — Two Pointers

LeetCode 88 merge sorted array in-place: reverse two pointers (merge from end) in O(m+n) time, O(1) space. Step-by-step + examples.

Min Stack

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time

Minimum Number of Refueling Stops

Find minimum refueling stops to reach target using greedy max-heap approach

Minimum Spanning Tree (MST): Kruskal vs Prim (DSU)

Learn what a minimum spanning tree is + MST algorithm steps. Kruskal (Union-Find) O(E log E) vs Prim (heap) O(E log V). Practice now.

Minimum Window Substring

Find the minimum window substring that contains all characters of another string

Move All Zeros to the End

Move all zeros in an array to the end while maintaining the relative order of non-zero elements

Network Delay Time (Dijkstra's Algorithm)

Find the time it takes for a signal to reach all nodes in a network using shortest path algorithms

Reduce Array Size to Half

Find minimum removals to reduce array size by half using greedy heap approach

Regular Expression Matching

Implement regular expression matching with support for '.' and '*'

Reorganize String (LC 767) — Greedy Max-Heap

Solve LC 767 with a greedy priority queue (max-heap). Learn the maxFreq ≤ ceil(n/2) condition + proof. O(n log k). Practice now.

Reverse an Array

Reverse the order of elements in an array in-place and return the modified array

Rotate Array by K Steps

Rotate an array to the right by k steps where k is non-negative

Rotten Oranges Problem

Find the minimum time for all oranges to rot using BFS

Serialize and Deserialize Binary Tree

Serialize a binary tree to a string and deserialize it back to the original tree

Sliding Window Maximum

Find the maximum element in each sliding window of size k

Sliding Window Median (LC 480) — Two Heaps, Lazy Delete

Hard LC 480: rolling median via sliding window + two heaps w/ lazy deletion. O(n log k) time, O(k) space. Step-by-step solution—prep now.

Smallest Substring with All Characters

Find the smallest substring that contains all characters of a given pattern

Sort Characters by Frequency

Sort characters in string by frequency using heap or bucket sort

Stock Span Problem

Calculate the span of stock prices for each day

Task Scheduler

Schedule tasks with cooling period using greedy approach with heap

Top K Frequent Elements (LC 347) — Bucket Sort + Heap

Solve LeetCode 347 Top K Frequent Elements (Medium) with frequency map + bucket sort O(n) or min-heap O(n log k). Step-by-step for interviews.

Trapping Rain Water

Calculate how much rainwater can be trapped between bars of different heights

Ugly Number II (LC 264) — Min-Heap + HashSet (Medium)

What is an ugly number? Solve n-th ugly number (2,3,5) with PriorityQueue + HashSet dedupe. O(n log n). Step-by-step—practice now.

Valid Anagram

Determine if two strings are anagrams of each other

Valid Parentheses

Determine if the input string has valid brackets that are properly opened and closed

Vertical Order Traversal of Binary Tree

Traverse a binary tree vertically and return nodes by columns

Word Ladder

Find the shortest transformation sequence from beginWord to endWord using single character changes