preloader
  • Home
  • Previous Questions

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

1st Jan, 0001

MICROSOFT

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
30Substring with Concatenation of All Words
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
47Permutations II
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
64Minimum Path Sum
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
82Remove Duplicates from Sorted List II
83Remove Duplicates from Sorted List
84Largest Rectangle in Histogram
85Maximal Rectangle
86Partition List
88Merge Sorted Array
90Subsets II
91Decode Ways
92Reverse Linked List II
93Restore IP Addresses
94Binary Tree Inorder Traversal
95Unique Binary Search Trees II
96Unique Binary Search Trees
97Interleaving String
98Validate Binary Search Tree
99Recover Binary Search Tree
100Same Tree
101Symmetric Tree
102Binary Tree Level Order Traversal
103Binary Tree Zigzag Level Order Traversal
104Maximum Depth of Binary Tree
105Construct Binary Tree from Preorder and Inorder Traversal
106Construct Binary Tree from Inorder and Postorder Traversal
108Convert Sorted Array to Binary Search Tree
109Convert Sorted List to Binary Search 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
119Pascal’s Triangle II
120Triangle
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
130Surrounded Regions
133Clone Graph
134Gas Station
135Candy
136Single Number
138Copy List with Random Pointer
139Word Break
140Word Break II
141Linked List Cycle
142Linked List Cycle II
143Reorder List
146LRU Cache
147Insertion Sort List
148Sort List
149Max Points on a Line
150Evaluate Reverse Polish Notation
151Reverse Words in a String
152Maximum Product Subarray
153Find Minimum in Rotated Sorted Array
154Find Minimum in Rotated Sorted Array II
155Min Stack
158Read N Characters Given read4 II - Call Multiple Times
159Longest Substring with At Most Two Distinct Characters
160Intersection of Two Linked Lists
162Find Peak Element
163Missing Ranges
165Compare Version Numbers
166Fraction to Recurring Decimal
167Two Sum II - Input Array Is Sorted
168Excel Sheet Column Title
169Majority Element
171Excel Sheet Column Number
172Factorial Trailing Zeroes
173Binary Search Tree Iterator
174Dungeon Game
175Combine Two Tables
176Second Highest Salary
177Nth Highest Salary
179Largest Number
181Employees Earning More Than Their Managers
184Department Highest Salary
186Reverse Words in a String II
189Rotate Array
190Reverse Bits
191Number of 1 Bits
192Word Frequency
198House Robber
199Binary Tree Right Side View
200Number of Islands
202Happy Number
203Remove Linked List Elements
204Count Primes
205Isomorphic Strings
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
216Combination Sum III
217Contains Duplicate
218The Skyline Problem
219Contains Duplicate II
221Maximal Square
222Count Complete Tree Nodes
224Basic Calculator
225Implement Stack using Queues
226Invert Binary Tree
227Basic Calculator II
229Majority Element II
230Kth Smallest Element in a BST
232Implement Queue using Stacks
233Number of Digit One
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
242Valid Anagram
250Count Univalue Subtrees
253Meeting Rooms II
257Binary Tree Paths
258Add Digits
261Graph Valid Tree
268Missing Number
269Alien Dictionary
270Closest Binary Search Tree Value
273Integer to English Words
274H-Index
277Find the Celebrity
278First Bad Version
279Perfect Squares
280Wiggle Sort
283Move Zeroes
285Inorder Successor in BST
286Walls and Gates
287Find the Duplicate Number
289Game of Life
292Nim Game
295Find Median from Data Stream
296Best Meeting Point
297Serialize and Deserialize Binary Tree
300Longest Increasing Subsequence
301Remove Invalid Parentheses
312Burst Balloons
314Binary Tree Vertical Order Traversal
315Count of Smaller Numbers After Self
316Remove Duplicate Letters
317Shortest Distance from All Buildings
319Bulb Switcher
322Coin Change
323Number of Connected Components in an Undirected Graph
324Wiggle Sort II
328Odd Even Linked List
329Longest Increasing Path in a Matrix
333Largest BST Subtree
336Palindrome Pairs
337House Robber III
338Counting Bits
340Longest Substring with At Most K Distinct Characters
341Flatten Nested List Iterator
343Integer Break
344Reverse String
345Reverse Vowels of a String
347Top K Frequent Elements
348Design Tic-Tac-Toe
349Intersection of Two Arrays
350Intersection of Two Arrays II
353Design Snake Game
354Russian Doll Envelopes
355Design Twitter
358Rearrange String k Distance Apart
359Logger Rate Limiter
362Design Hit Counter
365Water and Jug Problem
366Find Leaves of Binary Tree
367Valid Perfect Square
368Largest Divisible Subset
371Sum of Two Integers
373Find K Pairs with Smallest Sums
377Combination Sum IV
378Kth Smallest Element in a Sorted Matrix
380Insert Delete GetRandom O(1)
387First Unique Character in a String
389Find the Difference
392Is Subsequence
394Decode String
395Longest Substring with At Least K Repeating Characters
399Evaluate Division
400Nth Digit
402Remove K Digits
403Frog Jump
412Fizz Buzz
414Third Maximum Number
415Add Strings
416Partition Equal Subset Sum
417Pacific Atlantic Water Flow
419Battleships in a Board
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
449Serialize and Deserialize BST
450Delete Node in a BST
451Sort Characters By Frequency
452Minimum Number of Arrows to Burst Balloons
453Minimum Moves to Equal Array Elements
455Assign Cookies
456132 Pattern
460LFU Cache
462Minimum Moves to Equal Array Elements II
468Validate IP Address
472Concatenated Words
473Matchsticks to Square
475Heaters
480Sliding Window Median
485Max Consecutive Ones
486Predict the Winner
490The Maze
493Reverse Pairs
496Next Greater Element I
498Diagonal Traverse
503Next Greater Element II
505The Maze II
506Relative Ranks
509Inorder Successor in BST II
513Find Bottom Left Tree Value
516Longest Palindromic Subsequence
517Super Washing Machines
518Coin Change II
519Widest Pair of Indices With Equal Range Sum
525Contiguous Array
529Minesweeper
539Minimum Time Difference
540Single Element in a Sorted Array
541Reverse String II
54201 Matrix
543Diameter of Binary Tree
545Boundary of Binary Tree
556Next Greater Element III
557Reverse Words in a String III
560Subarray Sum Equals K
567Permutation in String
568Maximum Vacation Days
572Subtree of Another Tree
581Shortest Unsorted Continuous Subarray
582Kill Process
583Delete Operation for Two Strings
588Design In-Memory File System
591Tag Validator
593Valid Square
605Can Place Flowers
611Valid Triangle Number
621Task Scheduler
628Maximum Product of Three Numbers
631Design Excel Sum Formula
632Smallest Range Covering Elements from K Lists
636Exclusive Time of Functions
637Average of Levels in Binary Tree
640Solve the Equation
642Design Search Autocomplete System
643Maximum Average Subarray I
647Palindromic Substrings
6502 Keys Keyboard
6514 Keys Keyboard
653Two Sum IV - Input is a BST
654Maximum Binary Tree
661Image Smoother
662Maximum Width of Binary Tree
669Trim a Binary Search Tree
672Bulb Switcher II
678Valid Parenthesis String
680Valid Palindrome II
681Next Closest Time
684Redundant Connection
692Top K Frequent Words
694Number of Distinct Islands
695Max Area of Island
698Partition to K Equal Sum Subsets
716Max Stack
718Maximum Length of Repeated Subarray
720Longest Word in Dictionary
722Remove Comments
724Find Pivot Index
726Number of Atoms
729My Calendar I
733Flood Fill
735Asteroid Collision
739Daily Temperatures
744Network Delay Time
747Min Cost Climbing Stairs
758Convert Binary Search Tree to Sorted Doubly Linked List
761Employee Free Time
765Serialize and Deserialize N-ary Tree
768Partition Labels
774Maximum Depth of N-ary Tree
778Reorganize String
779Max Chunks To Make Sorted II
782Jewels and Stones
783Search in a Binary Search Tree
785Basic Calculator III
789Kth Largest Element in a Stream
792Binary Search
800Letter Case Permutation
801Is Graph Bipartite?
803Cheapest Flights Within K Stops
808Number of Matching Subsequences
810Valid Tic-Tac-Toe State
812Rotate String
816Design HashSet
817Design HashMap
823Split Array With Same Average
833Bus Routes
838Design Linked List
850Insert into a Sorted Circular Linked List
854Making A Large Island
860Design Circular Queue
862Find And Replace in String
864Image Overlap
865Robot Room Cleaner
866Rectangle Overlap
871Keys and Rooms
873Guess the Word
874Backspace String Compare
875Longest Mountain in Array
877Shortest Path Visiting All Nodes
879Maximize Distance to Closest Person
883Car Fleet
886Score of Parentheses
889Buddy Strings
893All Nodes Distance K in Binary Tree
900Reordered Power of 2
902Minimum Number of Refueling Stops
903Implement Rand10() Using Rand7()
908Middle of the Linked List
912Random Pick with Weight
917Boats to Save People
921Spiral Matrix III
922Possible Bipartition
931Maximum Frequency Stack
937Online Stock Span
941Sort Array By Parity
943Sum of Subarray Minimums
945Snakes and Ladders
948Sort an Array
957Minimum Add to Make Parentheses Valid
962Flip String to Monotone Increasing
971Shortest Bridge
988Flip Equivalent Binary Trees
990Verifying an Alien Dictionary
1007Numbers With Same Consecutive Differences
1008Binary Tree Cameras
1012Equal Rational Numbers
1013Fibonacci Number
1014K Closest Points to Origin
1016Subarray Sums Divisible by K
1019Squares of a Sorted Array
1021Distribute Coins in Binary Tree
1023Time Based Key-Value Store
1026String Without AAA or BBB
1028Interval List Intersections
1029Vertical Order Traversal of a Binary Tree
1032Satisfiability of Equality Equations
1035Cousins in Binary Tree
1036Rotting Oranges
1037Minimum Number of K Consecutive Bit Flips
1046Max Consecutive Ones III
1048Clumsy Factorial
1050Construct Binary Search Tree from Preorder Traversal
1056Capacity To Ship Packages Within D Days
1062Partition Array Into Three Parts With Equal Sum
1072Next Greater Node In Linked List
1078Remove Outermost Parentheses
1086Divisor Game
1087Longest Arithmetic Subsequence
1093Recover a Tree From Preorder Traversal
1095Two City Scheduling
1096Maximum Sum of Two Non-Overlapping Subarrays
1097Stream of Characters
1101Parallel Courses
1116Maximum Level Sum of a Binary Tree
1117As Far from Land as Possible
1122Longest Duplicate Substring
1125Design File System
1128Remove All Adjacent Duplicates In String
1139Previous Permutation With One Swap
1142Minimum Knight Moves
1143Find Smallest Common Element in All Rows
1170Shortest Common Supersequence
1171Shortest Path in Binary Matrix
1176Design A Leaderboard
1183Statistics from a Large Sample
1184Car Pooling
1201Delete Tree Nodes
1202Palindrome Removal
1203Print in Order
1205Defanging an IP Address
1230Maximum of Absolute Value Expression
1249Snapshot Array
1250Longest Common Subsequence
1253Sort the Matrix Diagonally
1254Deepest Leaves Sum
1260Day of the Year
1261Swap For Longest Repeated Character Substring
1271Web Crawler
1289Day of the Week
1297Maximum Number of Balloons
1298Reverse Substrings Between Each Pair of Parentheses
1300Critical Connections in a Network
1304Longest Happy String
1308Smallest String With Swaps
1320Remove All Adjacent Duplicates in String II
1337Design Skiplist
1348Maximum Score Of Spliced Array
1352Maximum Profit in Job Scheduling
1355Minimum Deletions to Make Array Beautiful
1356Minimum Number of Moves to Make Palindrome
1360Maximum Length of a Concatenated String with Unique Characters
1363Greatest English Letter in Upper and Lower Case
1371Minimum Remove to Make Valid Parentheses
1380Number of Closed Islands
1386Shift 2D Grid
1393Maximum Value of K Coins From Piles
1396Count Servers that Communicate
1397Search Suggestions System
1400Find Winner on a Tic Tac Toe Game
1402Count Square Submatrices with All Ones
1414Shortest Path in a Grid with Obstacles Elimination
1420Find the Start and End Number of Continuous Ranges
1426Find N Unique Integers Sum up to Zero
1428Jump Game III
1437Minimum Insertion Steps to Make a String Palindrome
1441Minimum Flips to Make a OR b Equal to c
1442Number of Operations to Make Network Connected
1444Number of Steps to Reduce a Number to Zero
1446Angle Between Hands of a Clock
1449Print Words Vertically
1451Minimum Number of Taps to Open to Water a Garden
1465Maximum Product of Splitted Binary Tree
1473Find the Longest Substring Containing Vowels in Even Counts
1476Count Negative Numbers in a Sorted Matrix
1487Cinema Seat Allocation
1491Number of Times Binary String Is Prefix-Aligned
1492Time Needed to Inform All Employees
1504Get the Second Most Recent Activity
1510Find Lucky Integer in an Array
1516The k-th Lexicographical String of All Happy Strings of Length n
1520Number of Steps to Reduce a Number in Binary Representation to One
1532Reformat The String
1544Count Good Nodes in Binary Tree
1560Number of Students Doing Homework at a Given Time
1569Max Dot Product of Two Subsequences
1573Find Two Non-overlapping Sub-arrays Each With Target Sum
1580Shuffle the Array
1582Design Browser History
1585The kth Factor of n
1587Parallel Courses II
1605Minimum Number of Days to Make m Bouquets
1609Find All The Lonely Nodes
1611Making File Names Unique
1617Stone Game IV
1618Delete N Nodes After M Nodes of a Linked List
1630Count Odd Numbers in an Interval Range
1635Number of Good Pairs
1637String Compression II
1642Water Bottles
1646Kth Missing Positive Number
1648Minimum Insertions to Balance a Parentheses String
1649Maximum Number of Non-Overlapping Subarrays With Sum Equals Target
1651Shuffle String
1669Minimum Cost to Cut a Stick
1674Minimum Operations to Make Array Equal
1678Number of Ways to Split a String
1698Replace All ?’s to Avoid Consecutive Repeating Characters
1700Minimum Time to Make Rope Colorful
1701Remove Max Number of Edges to Keep Graph Fully Traversable
1706Min Cost to Connect All Points
1708Design Parking System
1713Dot Product of Two Sparse Vectors
1714Rearrange Spaces Between Words
1738Maximal Network Rank
1742Widest Vertical Area Between Two Points Containing No Points
1743Count Substrings That Differ by One Character
1753Path With Minimum Effort
1756Minimum Deletions to Make String Balanced
1762Furthest Building You Can Reach
1766Minimum Number of Removals to Make Mountain Array
1770Minimum Deletions to Make Character Frequencies Unique
1780Lowest Common Ancestor of a Binary Tree II
1790Lowest Common Ancestor of a Binary Tree III
1799Minimum Incompatibility
1801Average Time of Process per Machine
1802Number of Students Unable to Eat Lunch
1805Minimum Adjacent Swaps for K Consecutive Ones
1829Maximum Units on a Truck
1831Ways to Split Array Into Three Subarrays
1833Find the Highest Altitude
1866Restore the Array From Adjacent Pairs
1873Longest Nice Substring
1883Find Distance in a Binary Tree
1894Merge Strings Alternately
1900Closest Dessert Cost
1901Equal Sum Arrays With Minimum Number of Operations
1908Recyclable and Low Fat Products
1909Buildings With an Ocean View
1915Check if One String Swap Can Make Strings Equal
1916Find Center of Star Graph
1925Count Nice Pairs in an Array
1929Maximum Value at a Given Index in a Bounded Array
1936Maximize Number of Nice Divisors
1950Sign of the Product of an Array
1951Find the Winner of the Circular Game
1966Frequency of the Most Frequent Element
1982Remove Duplicates From an Unsorted Linked List
1983Maximum Population Year
2016Reduction Operations to Make the Array Elements Equal
2031Egg Drop With 2 Eggs and N Floors
2033The Number of Full Rounds You Have Played
2076Sum of Digits of String After Convert
2082Minimum Cost to Separate Sentence Into Rows
2083Three Divisors
2095Minimum Number of Swaps to Make the String Balanced
2114Minimum Number of Work Sessions to Finish the Tasks
2117Find Original Array From Doubled Array
2121Find if Path Exists in Graph
2142Average Height of Buildings in Each Segment
2155Find Missing Observations
2162Partition Array Into Two Arrays to Minimize Sum Difference
2176Parallel Courses III
2217Step-By-Step Directions From a Binary Tree Node to Another
2220Find All Possible Recipes from Given Supplies
2242Subsequence of Size K With the Largest Even Sum
2243Check if All A’s Appears Before All B’s
2246Maximum Employees to Be Invited to a Meeting
2247Number of Unique Flavors After Sharing K Candies
2255Minimum Swaps to Group All 1’s Together II
2290Removing Minimum Number of Magic Beans
2292Counting Words With a Given Prefix
2299Merge Nodes in Between Zeros
2308Divide Array Into Equal Pairs
2310Minimum Operations to Halve Array Sum
2334Number of Flowers in Full Bloom
2337Remove Digit From Number to Maximize Result
2364Longest Path With Different Adjacent Characters
2383Add Two Integers
2384Root Equals Sum of Children
2418Minimum Sum of Squared Difference
2439Longest Cycle in a Graph
2453All the Matches of the League
2461Amount of Time for Binary Tree to Be Infected
2471Minimum Amount of Time to Collect Garbage
2473Max Sum of a Pair With Equal Sum of Digits
2475Largest Palindromic Number
2487Optimal Partition of String
2524Largest Positive Integer That Exists With Its Negative
2568Minimum Fuel Cost to Report to the Capital
2593Number of Distinct Binary Strings After Applying Operations
2634Minimum Common Value
2674Make the Prefix Sum Non-negative
2693Maximum Price to Fill a Bag
2720Minimize the Maximum Difference of Pairs
2756Buy Two Chocolates
2809Create Hello World Function
2823The Knight’s Tour
2902Max Pair Sum in an Array
3092Minimum Moves to Spread Stones Over Grid
3111Smallest Number With Given Digit Product