preloader
  • Home
  • Previous Questions

Contains previous problem statements given by various recruitors during their selection process.

1st Jan, 0001

Facebook

IDQuestions
1Two Sum
2Add Two Numbers
3Longest Substring Without Repeating Characters
4Median of Two Sorted Arrays
5Longest Palindromic Substring
6Zigzag Conversion
7Reverse Integer
8String to Integer (atoi)
9Palindrome Number
10Regular Expression Matching
11Container With Most Water
12Integer to Roman
13Roman to Integer
14Longest Common Prefix
153Sum
163Sum Closest
17Letter Combinations of a Phone Number
184Sum
19Remove Nth Node From End of List
20Valid Parentheses
21Merge Two Sorted Lists
22Generate Parentheses
23Merge k Sorted Lists
24Swap Nodes in Pairs
25Reverse Nodes in k-Group
26Remove Duplicates from Sorted Array
27Remove Element
28Find the Index of the First Occurrence in a String
29Divide Two Integers
31Next Permutation
32Longest Valid Parentheses
33Search in Rotated Sorted Array
34Find First and Last Position of Element in Sorted Array
35Search Insert Position
36Valid Sudoku
37Sudoku Solver
38Count and Say
39Combination Sum
40Combination Sum II
41First Missing Positive
42Trapping Rain Water
43Multiply Strings
44Wildcard Matching
45Jump Game II
46Permutations
48Rotate Image
49Group Anagrams
50Pow(x, n)
51N-Queens
53Maximum Subarray
54Spiral Matrix
55Jump Game
56Merge Intervals
57Insert Interval
58Length of Last Word
59Spiral Matrix II
61Rotate List
62Unique Paths
63Unique Paths II
65Valid Number
66Plus One
67Add Binary
68Text Justification
69Sqrt(x)
70Climbing Stairs
71Simplify Path
72Edit Distance
73Set Matrix Zeroes
74Search a 2D Matrix
75Sort Colors
76Minimum Window Substring
77Combinations
78Subsets
79Word Search
80Remove Duplicates from Sorted Array II
81Search in Rotated Sorted Array II
83Remove Duplicates from Sorted List
84Largest Rectangle in Histogram
85Maximal Rectangle
86Partition List
87Scramble String
88Merge Sorted Array
90Subsets II
91Decode Ways
92Reverse Linked List II
93Restore IP Addresses
94Binary Tree Inorder Traversal
95Unique Binary Search Trees II
98Validate Binary Search Tree
101Symmetric Tree
102Binary Tree Level Order Traversal
103Binary Tree Zigzag Level Order Traversal
104Maximum Depth of Binary Tree
109Convert Sorted List to Binary Search Tree
110Balanced Binary Tree
111Minimum Depth of Binary Tree
112Path Sum
113Path Sum II
114Flatten Binary Tree to Linked List
116Populating Next Right Pointers in Each Node
117Populating Next Right Pointers in Each Node II
118Pascal’s Triangle
121Best Time to Buy and Sell Stock
122Best Time to Buy and Sell Stock II
124Binary Tree Maximum Path Sum
125Valid Palindrome
126Word Ladder II
127Word Ladder
128Longest Consecutive Sequence
129Sum Root to Leaf Numbers
131Palindrome Partitioning
133Clone Graph
134Gas Station
135Candy
136Single Number
138Copy List with Random Pointer
139Word Break
140Word Break II
143Reorder List
146LRU Cache
148Sort List
150Evaluate Reverse Polish Notation
151Reverse Words in a String
152Maximum Product Subarray
153Find Minimum in Rotated Sorted Array
155Min Stack
157Read N Characters Given Read4
158Read N Characters Given read4 II - Call Multiple Times
159Longest Substring with At Most Two Distinct Characters
160Intersection of Two Linked Lists
161One Edit Distance
162Find Peak Element
163Missing Ranges
164Maximum Gap
166Fraction to Recurring Decimal
167Two Sum II - Input Array Is Sorted
168Excel Sheet Column Title
169Majority Element
171Excel Sheet Column Number
173Binary Search Tree Iterator
179Largest Number
180Consecutive Numbers
181Employees Earning More Than Their Managers
184Department Highest Salary
185Department Top Three Salaries
189Rotate Array
190Reverse Bits
191Number of 1 Bits
198House Robber
199Binary Tree Right Side View
200Number of Islands
202Happy Number
203Remove Linked List Elements
206Reverse Linked List
207Course Schedule
208Implement Trie (Prefix Tree)
209Minimum Size Subarray Sum
210Course Schedule II
211Design Add and Search Words Data Structure
212Word Search II
213House Robber II
215Kth Largest Element in an Array
217Contains Duplicate
218The Skyline Problem
219Contains Duplicate II
221Maximal Square
223Rectangle Area
224Basic Calculator
226Invert Binary Tree
227Basic Calculator II
229Majority Element II
230Kth Smallest Element in a BST
234Palindrome Linked List
235Lowest Common Ancestor of a Binary Search Tree
236Lowest Common Ancestor of a Binary Tree
237Delete Node in a Linked List
238Product of Array Except Self
239Sliding Window Maximum
240Search a 2D Matrix II
241Different Ways to Add Parentheses
242Valid Anagram
243Shortest Word Distance
246Strobogrammatic Number
247Strobogrammatic Number II
249Group Shifted Strings
252Meeting Rooms
253Meeting Rooms II
257Binary Tree Paths
2593Sum Smaller
260Single Number III
261Graph Valid Tree
263Ugly Number
265Paint House II
266Palindrome Permutation
267Palindrome Permutation II
268Missing Number
269Alien Dictionary
270Closest Binary Search Tree Value
271Encode and Decode Strings
273Integer to English Words
274H-Index
275H-Index II
277Find the Celebrity
278First Bad Version
282Expression Add Operators
283Move Zeroes
284Peeking Iterator
285Inorder Successor in BST
286Walls and Gates
287Find the Duplicate Number
290Word Pattern
295Find Median from Data Stream
296Best Meeting Point
297Serialize and Deserialize Binary Tree
298Binary Tree Longest Consecutive Sequence
299Bulls and Cows
300Longest Increasing Subsequence
301Remove Invalid Parentheses
303Range Sum Query - Immutable
304Range Sum Query 2D - Immutable
310Minimum Height Trees
311Sparse Matrix Multiplication
314Binary Tree Vertical Order Traversal
317Shortest Distance from All Buildings
319Bulb Switcher
322Coin Change
323Number of Connected Components in an Undirected Graph
325Maximum Size Subarray Sum Equals k
328Odd Even Linked List
329Longest Increasing Path in a Matrix
332Reconstruct Itinerary
333Largest BST Subtree
334Increasing Triplet Subsequence
337House Robber III
338Counting Bits
339Nested List Weight Sum
340Longest Substring with At Most K Distinct Characters
341Flatten Nested List Iterator
343Integer Break
344Reverse String
346Moving Average from Data Stream
347Top K Frequent Elements
348Design Tic-Tac-Toe
349Intersection of Two Arrays
350Intersection of Two Arrays II
366Find Leaves of Binary Tree
367Valid Perfect Square
371Sum of Two Integers
373Find K Pairs with Smallest Sums
374Guess Number Higher or Lower
377Combination Sum IV
378Kth Smallest Element in a Sorted Matrix
380Insert Delete GetRandom O(1)
381Insert Delete GetRandom O(1) - Duplicates allowed
383Ransom Note
384Shuffle an Array
386Lexicographical Numbers
387First Unique Character in a String
392Is Subsequence
394Decode String
398Random Pick Index
399Evaluate Division
402Remove K Digits
404Sum of Left Leaves
406Queue Reconstruction by Height
408Valid Word Abbreviation
410Split Array Largest Sum
412Fizz Buzz
415Add Strings
416Partition Equal Subset Sum
419Battleships in a Board
424Longest Repeating Character Replacement
435Non-overlapping Intervals
437Path Sum III
438Find All Anagrams in a String
442Find All Duplicates in an Array
443String Compression
445Add Two Numbers II
448Find All Numbers Disappeared in an Array
450Delete Node in a BST
451Sort Characters By Frequency
452Minimum Number of Arrows to Burst Balloons
460LFU Cache
461Hamming Distance
463Island Perimeter
477Total Hamming Distance
480Sliding Window Median
490The Maze
493Reverse Pairs
494Target Sum
496Next Greater Element I
498Diagonal Traverse
501Find Mode in Binary Search Tree
503Next Greater Element II
509Inorder Successor in BST II
515Find Largest Value in Each Tree Row
516Longest Palindromic Subsequence
518Coin Change II
523Continuous Subarray Sum
525Contiguous Array
528Swapping Nodes in a Linked List
529Minesweeper
530Minimum Absolute Difference in BST
535Encode and Decode TinyURL
536Construct Binary Tree from String
538Convert BST to Greater Tree
540Single Element in a Sorted Array
54201 Matrix
543Diameter of Binary Tree
545Boundary of Binary Tree
554Brick Wall
556Next Greater Element III
557Reverse Words in a String III
560Subarray Sum Equals K
567Permutation in String
572Subtree of Another Tree
578Get Highest Answer Rate Question
583Delete Operation for Two Strings
593Valid Square
595Big Countries
597Friend Requests I: Overall Acceptance Rate
602Friend Requests II: Who Has the Most Friends
605Can Place Flowers
606Construct String from Binary Tree
610Triangle Judgement
611Valid Triangle Number
616Add Bold Tag in String
617Merge Two Binary Trees
621Task Scheduler
623Add One Row to Tree
633Sum of Square Numbers
636Exclusive Time of Functions
637Average of Levels in Binary Tree
639Decode Ways II
642Design Search Autocomplete System
643Maximum Average Subarray I
647Palindromic Substrings
649Dota2 Senate
653Two Sum IV - Input is a BST
658Find K Closest Elements
661Image Smoother
662Maximum Width of Binary Tree
669Trim a Binary Search Tree
670Maximum Swap
673Number of Longest Increasing Subsequence
674Longest Continuous Increasing Subsequence
676Implement Magic Dictionary
678Valid Parenthesis String
680Valid Palindrome II
684Redundant Connection
687Longest Univalue Path
689Maximum Sum of 3 Non-Overlapping Subarrays
691Stickers to Spell Word
692Top K Frequent Words
695Max Area of Island
698Partition to K Equal Sum Subsets
711Number of Distinct Islands II
713Subarray Product Less Than K
714Best Time to Buy and Sell Stock with Transaction Fee
716Max Stack
721Accounts Merge
723Candy Crush
724Find Pivot Index
733Flood Fill
735Asteroid Collision
739Daily Temperatures
740Delete and Earn
746Prefix and Suffix Search
751Number Of Corner Rectangles
753Open the Lock
758Convert Binary Search Tree to Sorted Doubly Linked List
766Flatten a Multilevel Doubly Linked List
768Partition Labels
769Largest Plus Sign
777Toeplitz Matrix
778Reorganize String
785Basic Calculator III
789Kth Largest Element in a Stream
792Binary Search
794Swim in Rising Water
795K-th Symbol in Grammar
800Letter Case Permutation
801Is Graph Bipartite?
803Cheapest Flights Within K Stops
804Rotated Digits
807Custom Sort String
808Number of Matching Subsequences
813All Paths From Source to Target
817Design HashMap
819Minimum Swaps To Make Sequences Increasing
832Binary Tree Pruning
850Insert into a Sorted Circular Linked List
851Goat Latin
852Friends Of Appropriate Ages
854Making A Large Island
860Design Circular Queue
863Sum of Distances in Tree
865Robot Room Cleaner
866Rectangle Overlap
877Shortest Path Visiting All Nodes
882Peak Index in a Mountain Array
886Score of Parentheses
889Buddy Strings
893All Nodes Distance K in Binary Tree
896Smallest Subtree with all the Deepest Nodes
907Koko Eating Bananas
908Middle of the Linked List
912Random Pick with Weight
929Groups of Special-Equivalent Strings
930All Possible Full Binary Trees
931Maximum Frequency Stack
932Monotonic Array
933Increasing Order Search Tree
937Online Stock Span
941Sort Array By Parity
948Sort an Array
955Complete Binary Tree Inserter
957Minimum Add to Make Parentheses Valid
971Shortest Bridge
972Knight Dialer
975Range Sum of BST
976Minimum Area Rectangle
978Valid Mountain Array
990Verifying an Alien Dictionary
998Check Completeness of a Binary Tree
1008Binary Tree Cameras
1014K Closest Points to Origin
1016Subarray Sums Divisible by K
1019Squares of a Sorted Array
1025Minimum Cost For Tickets
1028Interval List Intersections
1029Vertical Order Traversal of a Binary Tree
1031Add to Array-Form of Integer
1035Cousins in Binary Tree
1038Number of Squareful Arrays
1040Maximum Binary Tree II
1046Max Consecutive Ones III
1050Construct Binary Search Tree from Preorder Traversal
1051Shortest Way to Form String
1056Capacity To Ship Packages Within D Days
1059Missing Element in Sorted Array
1073Number of Enclaves
1078Remove Outermost Parentheses
1091Maximum Average Subtree
1092Maximum Difference Between Node and Ancestor
1095Two City Scheduling
1099Path With Maximum Minimum Value
1103Moving Stones Until Consecutive
1113Moving Stones Until Consecutive II
1114Binary Search Tree to Greater Sum Tree
1116Maximum Level Sum of a Binary Tree
1121Partition Array for Maximum Sum
1128Remove All Adjacent Duplicates In String
1139Previous Permutation With One Swap
1142Minimum Knight Moves
1149Intersection of Three Sorted Arrays
1161Project Employees I
1162Project Employees II
1163Project Employees III
1171Shortest Path in Binary Matrix
1176Design A Leaderboard
1177Tree Diameter
1178Valid Palindrome III
1184Car Pooling
1185Find in Mountain Array
1205Defanging an IP Address
1207Delete Nodes And Return Forest
1215Reported Posts
1218Lowest Common Ancestor of Deepest Leaves
1221Element Appearing More Than 25% In Sorted Array
1222Remove Covered Intervals
1231Replace Elements with Greatest Element on Right Side
1237Reported Posts II
1245User Activity for the Past 30 Days I
1246User Activity for the Past 30 Days II
1256Rank Transform of an Array
1271Web Crawler
1275Validate Binary Tree Nodes
1285Balance a Binary Search Tree
1288Maximum Subarray Sum with One Deletion
1296Kth Ancestor of a Tree Node
1300Critical Connections in a Network
1305Number of Visible People in a Queue
1319Unique Number of Occurrences
1320Remove All Adjacent Duplicates in String II
1337Design Skiplist
1338Queries Quality and Percentage
1357Report Contiguous Dates
1366First Unique Number
1368Web Crawler Multithreaded
1371Minimum Remove to Make Valid Parentheses
1374Leftmost Column with at Least a One
1377Number of Comments per Post
1382Calculate Amount Paid in Taxes
1397Search Suggestions System
1399Page Recommendations
1400Find Winner on a Tic Tac Toe Game
1404Print Immutable Linked List in Reverse
1406Subtract the Product and Sum of Digits of an Integer
1414Shortest Path in a Grid with Obstacles Elimination
1427All Elements in Two Binary Search Trees
1446Angle Between Hands of a Clock
1453Ads Performance
1459Apply Discount Every n Orders
1460Number of Substrings Containing All Three Characters
1466Jump Game V
1498Find a Corresponding Node of a Binary Tree in a Clone of That Tree
1516The k-th Lexicographical String of All Happy Strings of Length n
1536Customers Who Bought Products A and B but Not C
1539Diagonal Traverse II
1542Consecutive Characters
1550Find the Kth Smallest Sum of a Matrix With Sorted Rows
1554Minimum Time to Collect All Apples in a Tree
1556Make Two Arrays Equal by Reversing Subarrays
1563Maximum Number of Darts Inside of a Circular Dartboard
1578Apples & Oranges
1579Active Users
1585The kth Factor of n
1603Running Sum of 1d Array
1621Number of Subsequences That Satisfy the Given Sum Condition
1635Number of Good Pairs
1646Kth Missing Positive Number
1648Minimum Insertions to Balance a Parentheses String
1663Detect Cycles in 2D Grid
1665Diameter of N-Ary Tree
1693Sum of All Odd Length Subarrays
1706Min Cost to Connect All Points
1713Dot Product of Two Sparse Vectors
1729Binary Search Tree Iterator II
1737Maximum Nesting Depth of the Parentheses
1760Check Array Formation Through Concatenation
1777Determine if Two Strings Are Close
1780Lowest Common Ancestor of a Binary Tree II
1781Check If Two String Arrays are Equivalent
1782Smallest String With A Given Numeric Value
1790Lowest Common Ancestor of a Binary Tree III
1801Average Time of Process per Machine
1819Construct the Lexicographically Largest Valid Sequence
1842Number of Calls Between Two Persons
1848Sum of Unique Elements
1883Find Distance in a Binary Tree
1894Merge Strings Alternately
1899Count Items Matching a Rule
1908Recyclable and Low Fat Products
1909Buildings With an Ocean View
1915Check if One String Swap Can Make Strings Equal
1931Shortest Path in a Hidden Grid
1942Primary Department for Each Employee
1951Find the Winner of the Circular Game
1959Minimum Path Cost in a Hidden Grid
1960Check if the Sentence Is Pangram
1962Single-Threaded CPU
1970Sorting the Sentence
1980Faulty Sensor
1995Finding Pairs With a Certain Sum
2019Product of Two Run-Length Encoded Arrays
2020Remove One Element to Make the Array Strictly Increasing
2038Nearest Exit from Entrance in Maze
2040Minimum Cost to Reach Destination in Time
2045Cutting Ribbons
2046Page Recommendations II
2048Build Array from Permutation
2078Maximum Compatibility Score Sum
2090Number of Ways to Arrive at Destination
2095Minimum Number of Swaps to Make the String Balanced
2097Strong Friendship
2102Find the Middle Index in Array
2107Find Unique Binary String
2123The Number of Weak Characters in the Game
2126Count Nodes Equal to Sum of Descendants
2133Number of Pairs of Strings With Concatenation Equal to Target
2134Maximize the Confusion of an Exam
2140Longest Subsequence Repeated k Times
2160Minimum Operations to Make a Uni-Value Grid
2184Check if an Original String Exists Given Two Encoded Strings
2211K Radius Subarray Averages
2217Step-By-Step Directions From a Binary Tree Node to Another
2316Count Hills and Valleys in an Array
2335Finding the Topic of Each Post
2342Minimum Average Difference
2347Count Nodes Equal to Average of Subtree
2374Steps to Make Array Non-decreasing
2383Add Two Integers
2473Max Sum of a Pair With Equal Sum of Digits
2483Task Scheduler II
2550Words Within Two Edits of Dictionary
2639Separate the Digits in an Array
2662Check Knight Tour Configuration
2696The Number of Beautiful Subsets
2732Counter
2809Create Hello World Function
2917Count Pairs Whose Sum is Less than Target
3206Find Common Elements Between Two Arrays