All company sheets
Microsoft logo

Microsoft DSA interview questions

61 problems to practise before your Microsoft online test or coding round. Most widely asked first.

61
Questions
16
Easy
36
Medium
9
Hard

Commonly reported. Problems candidates often report from this company’s coding rounds. These are Astra’s own tags, not an official question list.

Microsoft is hiring · 14 open roles on Astra right nowView roles

61 questions

  1. 1

    Find the Lowest Common Ancestor of a Binary Search Tree

    EasyRecursionTagged at 7 companies
  2. 2

    Calculate the Range Sum Query (Immutable)

    EasyArrayTagged at 7 companies
  3. 3

    Find the Maximum Number of Consecutive Ones

    EasyArrayTagged at 7 companies
  4. 4

    Reverse Log Viewer

    EasyTwo PointersTagged at 7 companies
  5. 5

    Find Minimum in Rotated Sorted Array

    MediumArrayTagged at 7 companies
  6. 6

    Find All Combinations that Sum to a Target

    MediumRecursionTagged at 7 companies
  7. 7

    Check if a Binary Tree is a Valid Binary Search Tree

    MediumRecursionTagged at 7 companies
  8. 8

    Flatten a Binary Tree to a Linked List

    MediumRecursionTagged at 7 companies
  9. 9

    Construct Binary Tree from Preorder and Inorder Traversal

    MediumRecursionTagged at 7 companies
  10. 10

    Search in a Rotated Sorted Array

    MediumRecursionTagged at 7 companies
  11. 11

    Find the Number of Islands in a Grid

    MediumRecursionTagged at 7 companies
  12. 12

    Search in a Nearly Sorted Array

    MediumBinary SearchTagged at 7 companies
  13. 13

    Find K Closest Elements to a Target X

    MediumBinary SearchTagged at 7 companies
  14. 14

    Find the Container with the Most Water

    MediumArrayTagged at 7 companies
  15. 15

    Find the Subarray Sum That Equals K

    MediumArrayTagged at 7 companies
  16. 16

    Find the Longest Subarray with Sum Divisible by K

    MediumArrayTagged at 7 companies
  17. 17

    Find the Gas Station (Circular Route)

    MediumArrayTagged at 7 companies
  18. 18

    Traffic Congestion Relief Window

    MediumSliding WindowTagged at 7 companies
  19. 19

    Max Consecutive Ones III

    MediumSliding WindowTagged at 7 companies
  20. 20

    Maximum Number of Vowels in a Substring of Given Length

    MediumSliding WindowTagged at 7 companies
  21. 21

    Sort Colors

    MediumTwo PointersTagged at 7 companies
  22. 22

    Merge Two Binary Trees

    EasyTreeTagged at 6 companies
  23. 23

    Calculate Score in Baseball Game with Stack Operations

    EasyStack and QueueTagged at 6 companies
  24. 24

    Find the Middle of a Singly Linked List

    EasyLinkedListTagged at 6 companies
  25. 25

    Remove All Linked List Elements with a Given Value

    EasyLinkedListTagged at 6 companies
  26. 26

    Delete a Node in a Doubly Linked List

    EasyLinkedListTagged at 6 companies
  27. 27

    Check if a Linked List is Identical to Another

    EasyLinkedListTagged at 6 companies
  28. 28

    Find all Root-to-Leaf Paths in an N-ary Tree

    EasyTreeTagged at 6 companies
  29. 29

    Check if an N-ary Tree is Symmetric

    EasyTreeTagged at 6 companies
  30. 30

    Check if Two Strings are Valid Anagrams

    EasyStringTagged at 6 companies
  31. 31

    Reverse a String In-Place

    EasyStringTagged at 6 companies
  32. 32

    Find the First Unique (Non-Repeating) Character in a String

    EasyStringTagged at 6 companies
  33. 33

    Unique Paths

    MediumDynamic ProgrammingTagged at 6 companies
  34. 34

    Longest Common Subsequence

    MediumDynamic ProgrammingTagged at 6 companies
  35. 35

    Word Break

    MediumDynamic ProgrammingTagged at 6 companies
  36. 36

    Perfect Squares

    MediumDPTagged at 6 companies
  37. 37

    Minimum Jumps to Reach End

    MediumDPTagged at 6 companies
  38. 38

    Calculate the Score of a Parentheses String

    MediumStack and QueueTagged at 6 companies
  39. 39

    Design a Doubly Linked List Implementation

    MediumLinkedListTagged at 6 companies
  40. 40

    Swap Kth Node from Beginning and Kth Node from End

    MediumLinkedListTagged at 6 companies
  41. 41

    Find the Kth Largest Element in an Array (Heap)

    MediumTreeTagged at 6 companies
  42. 42

    Clone an Undirected Graph (DFS/BFS)

    MediumTreeTagged at 6 companies
  43. 43

    Find Longest Repeating Character Replacement

    MediumStringTagged at 6 companies
  44. 44

    Implement a Basic Calculator with '+' and '-'

    MediumStringTagged at 6 companies
  45. 45

    Multiply Two Large Numbers Represented as Strings

    MediumStringTagged at 6 companies
  46. 46

    Airbnb Booking Calendar Overlap

    MediumIntervalsTagged at 6 companies
  47. 47

    Median of Two Sorted Arrays

    HardBinary SearchTagged at 6 companies
  48. 48

    Find the Latest Step to Form a Group of Size M

    HardBinary SearchTagged at 6 companies
  49. 49

    Video Game Terrain Water Physics

    HardTwo PointersTagged at 6 companies
  50. 50

    Representing a Graph (Adjacency List & Matrix)

    EasyGraphTagged at 5 companies
  51. 51

    Number of Islands

    MediumGraphTagged at 5 companies
  52. 52

    Letter Combinations of a Phone Number

    MediumBacktrackingTagged at 5 companies
  53. 53

    Topological Sorting (Kahn’s Algorithm)

    MediumGraphTagged at 5 companies
  54. 54

    Cycle in Undirected Graph (BFS)

    MediumGraphTagged at 5 companies
  55. 55

    Rotting Oranges (BFS Multi-Source)

    MediumGraphTagged at 5 companies
  56. 56

    Largest Rectangle in Histogram

    HardStackTagged at 5 companies
  57. 57

    Find the Binary Tree Maximum Path Sum (Amazon/Apple)

    HardTreeTagged at 5 companies
  58. 58

    Check if a String is a Valid Number (Scientific Notation)

    HardStringTagged at 5 companies
  59. 59

    Best Time to Buy and Sell Stock IV

    HardDPTagged at 4 companies
  60. 60

    Scramble String

    HardDPTagged at 4 companies
  61. 61

    Paint House III

    HardDPTagged at 4 companies

More company sheets