100 Data Structures and Algorithms Problems Asked During Coding Interviews

Amit Shekhar
Dec 4, 2019 · 5 min read
Image for post
Image for post

Recently our team at AfterAcademy has prepared the “Tech Interview Preparation Kit” for the developers to help them in cracking the coding interview. For that, our team has done hard work and gathered the top 100 Data Structure and Algorithm questions asked during the coding interview.

Here, we have listed the 100 Data Structures and Algorithms Problems asked during the coding interviews in companies like Amazon, Microsoft, Facebook, LinkedIn, Adobe, Uber, Yahoo, eBay, and etc. You can go to the problem link and practice the problems in the online IDE.

Practice problems and never give up!

Let’s get started with the questions.

  1. Roman To Integer

Asked in: Amazon, Microsoft, Facebook

2. Reverse Bits

Asked in: Amazon

3. Square Root of Integer

Asked in: Amazon, Microsoft, Facebook

4. Calculate power function

Asked in: Google, LinkedIn, Amazon

5. Greatest Common Divisor

Asked in: Google

6. Find the Closest Palindrome

Asked in: Microsoft, Amazon

7. Rotate matrix

Asked in: Google

8. Spiral Matrix

Asked in: Microsoft, Amazon

9. Wave Array

Asked in: Amazon, Google, Adobe

10. Set Matrix Zeroes

Asked in: Amazon, Google

11. maximum j — i such that A[j] > A[i]

Asked in: Google, Amazon, Adobe

12. Move zeroes to an end

Asked in: Facebook, Uber

13. Merge two sorted arrays

Asked in: Microsoft, Adobe

14. Container with Most Water

Asked in: Amazon, Google, Facebook, Adobe

15. Remove duplicates from sorted array

Asked in: Amazon, Microsoft, Google

16. Find an element in Bitonic array

Asked in: Amazon

17. Find minimum element in sorted and rotated array

Asked in: Facebook

18. Median of two sorted array of same size

Asked in: Amazon, Microsoft, Google

19. Inversion count in an array

Asked in: Amazon, Google

20. Search for a Range in a sorted array

Asked in: Microsoft, Google

21. Longest Common Prefix

Asked in: Amazon, Google

22. Median in row wise sorted matrix

Asked in: Amazon

23. Swap List Nodes in pairs

Asked in: Amazon, Microsoft

24. Add Two Numbers as Lists

Asked in: Amazon, Microsoft, Facebook

25. Check if a singly linked list is palindrome

Asked in: Amazon, Microsoft

26. Reverse a linked list from position m to n

Asked in: Amazon, Microsoft, Facebook

27.Detect and Remove Loop in a Linked List

Asked in: Amazon, Microsoft

28. Merge Two Sorted Lists

Asked in: Amazon, Microsoft, Yahoo

29. Remove Nth Node from List End

Asked in: Amazon

30. Sort a linked list using insertion sort

Asked in: Microsoft, Google

31. Find next greater element in an array

Asked in: Amazon, Microsoft

32. Trapping rain water

Asked in: Amazon, Google

33. Merge overlapping intervals

Asked in: Amazon, Google

34. Largest Rectangle in Histogram

Asked in: Amazon, Google, Facebook

35. Check for balanced parentheses in an expression

Asked in: Amazon, Microsoft

36. Min Stack Problem

Asked in: Amazon, Microsoft, Yahoo, Adobe

37. LRU Cache implementation

Asked in: Amazon, Microsoft, Adobe, Google

38. Sort a stack using another stack

Asked in: Amazon, Microsoft

39. Lowest Common Ancestor of a Binary tree

Asked in: Amazon, Google, Microsoft, Facebook, Adobe

40. Path sum in binary tree

Asked in: Amazon, Microsoft, Yahoo

41. Min Depth of Binary Tree

Asked in: Amazon, Facebook

42. Binary Tree Zigzag Level Order Traversal

Asked in: Amazon, Microsoft

43. Invert Binary Tree

Asked in: Amazon, Google

44. Flatten Binary Tree to Linked List

Asked in: Amazon, Microsoft, Yahoo, Adobe

45. Find diameter of binary tree

Asked in: Facebook, Google, Amazon

46. All Nodes Distance K in Binary Tree

Asked in: Microsoft

47. Merge two binary tree

Asked in: Amazon, Microsoft

48. Shortest Unique Prefix

Asked in: Google

49. Sorted Array To Balanced BST

Asked in: Amazon

50. K-th largest element in BST

Asked in: Amazon

51. Minimum absolute difference in BST

Asked in: Google

52. Recover Binary Search Tree

Asked in: Amazon, Microsoft

53. Merge Two BST

Asked in: Google, Amazon, Microsoft

54. Lowest Common Ancestor of a BST

Asked in: Amazon, Microsoft

55. K Pairs with Smallest Sums

Asked in: Google

56. Sliding window maximum

Asked in: Amazon, Google

57. Merge K sorted list

Asked in: Amazon, Google

58. Convert a min heap to max heap

Asked in: Google

59. Check if two arrays are equal or not

Asked in: Amazon, Goldman Sachs

60. Intersection of two unsorted array

Asked in: Google, Facebook

61. Longest Consecutive Sequence

Asked in: Amazon, Google

62. Valid Anagram

Asked in: Google, Amazon, Microsoft

63. Majority Element

Asked in: Amazon, Microsoft, Yahoo, Google

64. Sort Characters by Frequency

Asked in: Facebook, Google

65. First Unique Character in a String

Asked in: Amazon, Microsoft

66. Triplet with zero sum

Asked in: Facebook, Amazon, Microsoft

67. First missing positive

Asked in: Amazon

68. Largest subarray with 0 sum

Asked in: Microsoft

69. Max points on the straight line

Asked in: Amazon, Google

70. Climbing Stairs Problem

Asked in: Amazon, Google

71. Matrix Chain Multiplication

Asked in: Amazon, Microsoft

72. Longest Increasing subsequence

Asked in: Amazon, Microsoft, Facebook

73. Partition Equal Subset Sum

Asked in: Amazon, Adobe

74. Minimum number of jumps to reach end

Asked in: Amazon, Google, eBay

75. Interleaving String

Asked in: Google, Microsoft, Yahoo

76. Coin change problem

Asked in: Microsoft

77. Edit distance Problem

Asked in: Amazon, Google, Microsoft

78. Min Cost Path

Asked in: Amazon

79. Maximal Square

Asked in: Google, Microsoft

80. Longest Arithmetic Progression

Asked in: Google, Microsoft

81. Word break problem

Asked in: Facebook, Google

82. Maximum Subarray Sum

Asked in: Amazon, Microsoft, Yahoo, Facebook

83. Palindrome Partitioning

Asked in: Amazon, Google

84. Max Product Subarray

Asked in: Amazon, Microsoft

85. Maximum Product of Three Numbers

Asked in: Amazon

86. Gas station Problem

Asked in: Amazon, Google

87. Distribute Candy Problem

Asked in: Amazon, Microsoft

88. Fractional Knapsack problem

Asked in: Amazon

89. Sudoku Solver

Asked in: Amazon, Google, Microsoft

90. Generate Parentheses

Asked in: Facebook, Microsoft

91. Print all subset

Asked in: Amazon, Microsoft, Facebook

92. Combination Sum

Asked in: Amazon, Facebook, Adobe

93. Combinations

Asked in: Amazon, Adobe

94. Letter Combinations of a Phone Number

Asked in: Google

95. Word ladder problem

Asked in: Google, Microsoft, eBay

96. Smallest Multiple With 0 and 1

Asked in: Amazon

97. Check loop in array according to given constraints

Asked in: Google, Amazon

98. Course Schedule

Asked in: Amazon

99. Knight on chessboard

Asked in: Amazon, Goldman Sachs

100. Surrounded regions

Asked in: Google

You can also find all the problems topic-wise here.

Bonus:

What is System Design? A Beginner-Friendly Introduction

Thanks for reading.

Clap, share if you like it and follow me for the updates.

AfterAcademy

A platform for learning coding & software development.

Amit Shekhar

Written by

Working with the smartest people in the world to change the way we learn. EdTech products: MindOrks | AfterAcademy | CuriousJr | https://amitshekhar.me

AfterAcademy

A platform for learning coding & software development. https://afteracademy.com

Amit Shekhar

Written by

Working with the smartest people in the world to change the way we learn. EdTech products: MindOrks | AfterAcademy | CuriousJr | https://amitshekhar.me

AfterAcademy

A platform for learning coding & software development. https://afteracademy.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store