Coding interview problems
3,736 problems: 937 Easy, 1,914 Medium, 885 Hard. Each runs against hidden tests, in 13 languages; database problems in SQL. Free for members.
Solve them in the app Explore guides
Problems 2,001–2,100 of 3,736
- 2001. Subtree Sums with Edits Hard · Tree, Depth-First Search, Array, Design
- 2002. Path Maximum with Edits Hard · Tree, Depth-First Search, Design, Divide and Conquer
- 2003. Close Pairs in a Tree Hard · Tree, Divide and Conquer, Depth-First Search, Sorting
- 2004. Nearest Lit Node Queries Hard · Tree, Divide and Conquer, Design
- 2005. Longest Path with Changing Labels Hard · Tree, Depth-First Search, String, Dynamic Programming
- 2006. Coins at the Far Edges Hard · Tree, Graph, Breadth-First Search, Topological Sort
- 2007. Paths Whose Ends Are the Peak Hard · Tree, Union Find, Sorting
- 2008. Three-Way XOR Split Hard · Tree, Depth-First Search, Bit Manipulation
- 2009. Nearest Coprime Ancestor Hard · Tree, Depth-First Search, Math
- 2010. Where the Frog Lands Hard · Tree, Breadth-First Search, Math
- 2011. Distinct Colours in Every Subtree Hard · Tree, Depth-First Search, Hash Table
- 2012. Cut into One-Marked Pieces Hard · Tree, Dynamic Programming, Depth-First Search
- 2013. Most Pieces Divisible by k Hard · Tree, Depth-First Search, Greedy
- 2014. Smaller Descendants Count Hard · Tree, Depth-First Search, Array
- 2015. Fewest Road Flips from Each Town Hard · Tree, Depth-First Search, Dynamic Programming, Graph
- 2016. Best Connected Team of Size k Hard · Tree, Dynamic Programming, Depth-First Search
- 2017. Fewest Stations Within Reach Hard · Tree, Greedy, Depth-First Search
- 2018. Strongest XOR Path in a Weighted Tree Hard · Tree, Trie, Bit Manipulation
- 2019. Joining Two Parks with One Trail Hard · Tree, Graph, Breadth-First Search
- 2020. Smallest Missing Code in Each Subtree Hard · Tree, Depth-First Search, Hash Table
- 2021. Best Trail Starting from Every Node Hard · Tree, Depth-First Search, Dynamic Programming
- 2022. Rotations in a Self-Balancing Tree Hard · Tree, Binary Search Tree, Design, Simulation
- 2023. Rank Tracker for a Live Stream Hard · Tree, Design, Array, Binary Search
- 2024. Find Many Words in a Letter Grid Hard · Trie, Backtracking, Matrix
- 2025. Words Made of Other Words Hard · Trie, String, Dynamic Programming
- 2026. Watch a Character Stream for Words Hard · Trie, Design, String
- 2027. XOR Queries Under a Cap Hard · Trie, Bit Manipulation, Sorting
- 2028. Pairs with XOR Inside a Window Hard · Trie, Bit Manipulation
- 2029. Lookup by Prefix and Suffix Together Hard · Trie, Design, String
- 2030. Prefix Popularity per Word Hard · Trie, String, Counting
- 2031. Best Suffix Match for Each Query Hard · Trie, String
- 2032. Smaller Values to the Right Hard · Tree, Array, Divide and Conquer, Binary Search
- 2033. Big Inversions Hard · Tree, Array, Divide and Conquer, Sorting
- 2034. Range Raises and Range Totals Hard · Tree, Array, Design, Divide and Conquer
- 2035. Stacking Crates on a Shelf Hard · Tree, Array, Divide and Conquer
- 2036. Editable Grid Totals Hard · Tree, Design, Matrix, Prefix Sum
- 2037. Peak Overlap Bookings Hard · Tree, Design, Divide and Conquer
- 2038. Climbs with Bounded Steps Hard · Tree, Divide and Conquer, Dynamic Programming
- 2039. Tracked Intervals Hard · Tree, Design, Intervals
- 2040. Cost of Building a Sorted Shelf Hard · Tree, Array, Binary Search
- 2041. Best Segment After Each Edit Hard · Tree, Array, Divide and Conquer
- 2042. Triplets in the Same Order in Two Rankings Hard · Tree, Array, Binary Search
- 2043. Running Kth Smallest with Deletes Hard · Tree, Design, Binary Search
- 2044. Decode Bits with a Code Tree Easy · Tree, Binary Tree, String, Simulation
- 2045. Subtrees with Totals in a Window Medium · Tree, Binary Tree, Depth-First Search
- 2046. Could This Be a BST's Row Order Medium · Tree, Binary Search Tree, Queue, Breadth-First Search
- 2047. Sift a Complete Tree into a Max-Heap Medium · Tree, Binary Tree, Heap (Priority Queue)
- 2048. Neighbourhood Totals Within Two Steps Medium · Tree, Depth-First Search, Graph
- 2049. Recolour into Alternating Colours Medium · Tree, Breadth-First Search, Graph
- 2050. Shortcuts from the Root Medium · Tree, Greedy, Depth-First Search
- 2051. Smallest Preorder by Child Swaps Medium · Tree, Binary Tree, Depth-First Search, Sorting
- 2052. Ancestor Divides Descendant Medium · Tree, Binary Tree, Depth-First Search, Hash Table
- 2053. Longest-Match Tokenizer Medium · Trie, String
- 2054. Prefix Pairs in a Word List Medium · Trie, String, Counting
- 2055. Print a Tree on a Grid Medium · Tree, Binary Tree, Depth-First Search, String
- 2056. Subtrees Without Repeated Values Medium · Tree, Binary Tree, Depth-First Search, Bit Manipulation
- 2057. Path to a Label in an Endless Tree Easy · Tree, Binary Tree, Math
- 2058. Place k Calm Markers Hard · Tree, Dynamic Programming, Depth-First Search
- 2059. Count Above a Threshold in Ranges Hard · Tree, Array, Divide and Conquer, Binary Search
- 2060. Points Inside Each Rectangle Hard · Tree, Array, Sorting, Prefix Sum
- 2061. Separate the Rival Camps Hard · Tree, Dynamic Programming, Depth-First Search
- 2062. Distinct Team Structures Hard · Tree, Hash Table, Depth-First Search, Sorting
- 2063. Guesses About the Root Hard · Tree, Depth-First Search, Dynamic Programming, Graph
- 2064. Clusters Counted by Diameter Hard · Tree, Bit Manipulation, Breadth-First Search
- 2065. Pruning Game on a Tree Hard · Tree, Depth-First Search, Math
- 2066. Diameter as the Tree Grows Hard · Tree, Depth-First Search, Bit Manipulation
- 2067. Palindrome-Ready Paths in a Lettered Tree Hard · Tree, Depth-First Search, Bit Manipulation, Hash Table
- 2068. Split into Small Teams Hard · Tree, Greedy, Depth-First Search
- 2069. Collect or Halve Down the Tree Hard · Tree, Dynamic Programming, Depth-First Search, Memoization
- 2070. Sum of Path Maximums Hard · Tree, Union Find, Sorting
- 2071. Two Separate Subtrees with the Strongest XOR Hard · Trie, Depth-First Search, Bit Manipulation
- 2072. Bookend Pairs Hard · Trie, String
- 2073. Cheapest Way to Spell a Target Hard · Trie, Dynamic Programming
- 2074. Distinct Values in Each Range Query Hard · Tree, Array, Sorting
- 2075. Longest Free Stretch After Each Booking Hard · Tree, Design, Divide and Conquer
- 2076. Count the Longest Rising Picks Hard · Tree, Dynamic Programming, Array
- 2077. Kth Lit Bulb After Toggles Hard · Tree, Divide and Conquer, Design
- 2078. Largest Complete Subtree Inside Hard · Tree, Binary Tree, Depth-First Search
- 2079. Ways a Logic Expression Comes Out True Hard · Tree, Dynamic Programming, String
- 2080. Last Stone Weight Easy · Array, Heap (Priority Queue), Simulation · Asked at Amazon, Google
- 2081. Take Gifts From the Richest Pile Easy · Array, Heap (Priority Queue), Simulation
- 2082. Kth Largest Element in an Array Medium · Array, Divide and Conquer, Sorting, Heap (Priority Queue) · Asked at Meta, Amazon, Google
- 2083. K Closest Points to Origin Medium · Array, Math, Sorting, Heap (Priority Queue) · Asked at Meta, Amazon
- 2084. IPO Hard · Array, Greedy, Sorting, Heap (Priority Queue) · Asked at Amazon
- 2085. Trapping Rain Water II Hard · Array, Heap (Priority Queue), Breadth-First Search, Matrix · Asked at Google, Amazon
- 2086. Does This Array Form a Min-Heap Easy · Array, Heap (Priority Queue)
- 2087. Is This Tree a Max-Heap Medium · Tree, Binary Tree, Breadth-First Search, Heap (Priority Queue)
- 2088. Count Max-Heap Arrangements Medium · Math, Dynamic Programming, Tree, Heap (Priority Queue)
- 2089. Fewest Studios for All Recordings Medium · Array, Intervals, Sorting, Heap (Priority Queue)
- 2090. Median of Every Window Hard · Array, Sliding Window, Heap (Priority Queue)
- 2091. Array After Inserting Into a Min-Heap Easy · Array, Heap (Priority Queue), Simulation
- 2092. Swaps Needed to Heapify Easy · Array, Heap (Priority Queue), Simulation
- 2093. Level Totals of a Heap Array Easy · Array, Heap (Priority Queue), Math
- 2094. Flip a Min-Heap Into a Max-Heap Easy · Array, Heap (Priority Queue)
- 2095. Remove an Arbitrary Slot From a Min-Heap Easy · Array, Heap (Priority Queue)
- 2096. Lower a Priority Inside a Min-Heap Easy · Array, Heap (Priority Queue)
- 2097. Heapsort Midway Snapshot Easy · Array, Heap (Priority Queue), Sorting
- 2098. Kth Smallest Without Emptying the Heap Easy · Array, Heap (Priority Queue)
- 2099. The K Lowest Exam Scores Easy · Array, Heap (Priority Queue), Sorting
- 2100. Kth Highest Distinct Sensor Reading Easy · Array, Hash Table, Heap (Priority Queue)