All Paths From Source to Target
Find all possible paths from source node to target node in a directed acyclic graph (DAG)
Coin Change II LC 518: DP Count Ways (Unbounded)
Medium DP/unbounded knapsack: dp[x]+=dp[x-c] counts coin change ways (no permutations). O(n·amount) time, O(amount) space. Practice now.
Detect Cycle in Undirected Graph (DFS/BFS, Union-Find)
Learn graph cycle detection in an undirected graph using DFS/BFS parent tracking or Union-Find (DSU). O(V+E). Step-by-step—practice now.
Find K Smallest Elements
Find the k smallest elements from an unsorted array
Group Anagrams
Group strings that are anagrams of each other together.
Jump Game II
Given an array where each element represents the maximum jump length, find the minimum number of jumps to reach the last index
Longest Substring Without Repeating Characters
Find the length of the longest substring without repeating characters
LRU Cache
Design a data structure that follows Least Recently Used (LRU) eviction with O(1) get and put operations.
Meeting Rooms II
Find minimum number of meeting rooms required using heap
Merge Intervals
Given an array of intervals where intervals[i] = [start_i, end_i], merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input.
Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time
Move All Zeros to the End
Move all zeros in an array to the end while maintaining the relative order of non-zero elements
Number of Islands
Count the number of islands in a 2D grid
Search in Rotated Sorted Array
Given a rotated sorted array and a target value, return the index of the target if found in O(log n) time, or -1 if not present.
Subsets
Given an integer array of unique elements, return all possible subsets (the power set)
Task Scheduler
Find the minimum number of intervals the CPU will take to finish all given tasks with a cooldown period between identical tasks
Trapping Rain Water
Calculate how much rainwater can be trapped between bars of different heights
Two Sum
Given an array of integers and a target, return indices of two numbers that add up to the target.
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
Given two strings, determine if one is an anagram of the other.
Valid Anagram
Determine if two strings are anagrams of each other
Word Search
Given an m x n grid of characters and a string word, return true if the word exists in the grid by traversing adjacent cells without reusing any cell