Two Pointers DSA Problems

217 two pointers problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 217: 60 easy, 12 medium and 28 hard. Practise them free on InternHack and track what you have solved.

Two Pointers problems, easiest first

  1. Apply Operations to an Array (Easy)
  2. Assign Cookies (Easy)
  3. Backspace String Compare (Easy)
  4. Check If a Word Occurs As a Prefix of Any Word in a Sentence (Easy)
  5. Check If N and Its Double Exist (Easy)
  6. Check If String Is a Prefix of Array (Easy)
  7. Count Binary Substrings (Easy)
  8. Count Pairs Whose Sum is Less than Target (Easy)
  9. Count the Number of Incremovable Subarrays I (Easy)
  10. DI String Match (Easy)
  11. Duplicate Zeros (Easy)
  12. Faulty Sensor (Easy)
  13. Find All K-Distant Indices in an Array (Easy)
  14. Find First Palindromic String in the Array (Easy)
  15. Find Indices With Index and Value Difference I (Easy)
  16. Find the Array Concatenation Value (Easy)
  17. Find the Distance Value Between Two Arrays (Easy)
  18. Find the Index of the First Occurrence in a String (Easy)
  19. Flipping an Image (Easy)
  20. Happy Number (Easy)
  21. Intersection of Two Arrays (Easy)
  22. Intersection of Two Arrays II (Easy)
  23. Intersection of Two Linked Lists (Easy)
  24. Is Subsequence (Easy)
  25. Largest Positive Integer That Exists With Its Negative (Easy)
  26. Lexicographically Smallest Palindrome (Easy)
  27. Linked List Cycle (Easy)
  28. Long Pressed Name (Easy)
  29. Merge Sorted Array (Easy)
  30. Merge Strings Alternately (Easy)
  31. Merge Two 2D Arrays by Summing Values (Easy)
  32. Middle of the Linked List (Easy)
  33. Minimum Average of Smallest and Largest Elements (Easy)
  34. Minimum Common Value (Easy)
  35. Move Zeroes (Easy)
  36. Number of Arithmetic Triplets (Easy)
  37. Number of Distinct Averages (Easy)
  38. Palindrome Linked List (Easy)
  39. Remove Duplicates from Sorted Array (Easy)
  40. Remove Element (Easy)
  41. Remove Palindromic Subsequences (Easy)
  42. Reverse Only Letters (Easy)
  43. Reverse Prefix of Word (Easy)
  44. Reverse String (Easy)
  45. Reverse String II (Easy)
  46. Reverse String Prefix (Easy)
  47. Reverse Vowels of a String (Easy)
  48. Reverse Words in a String III (Easy)
  49. Shortest Distance to a Character (Easy)
  50. Sort Array By Absolute Value (Easy)
  51. Sort Array By Parity (Easy)
  52. Sort Array By Parity II (Easy)
  53. Squares of a Sorted Array (Easy)
  54. Strobogrammatic Number (Easy)
  55. Two Sum III - Data structure design (Easy)
  56. Two Sum IV - Input is a BST (Easy)
  57. Two Sum Less Than K (Easy)
  58. Valid Palindrome (Easy)
  59. Valid Palindrome II (Easy)
  60. Valid Word Abbreviation (Easy)
  61. 3Sum (Medium)
  62. 3Sum Closest (Medium)
  63. 3Sum Smaller (Medium)
  64. 3Sum With Multiplicity (Medium)
  65. 4Sum (Medium)
  66. Add Two Polynomials Represented as Linked Lists (Medium)
  67. Adding Spaces to a String (Medium)
  68. Advantage Shuffle (Medium)
  69. Append Characters to String to Make Subsequence (Medium)
  70. Bag of Tokens (Medium)
  71. Boats to Save People (Medium)
  72. Camelcase Matching (Medium)
  73. Checking Existence of Edge Length Limited Paths (Hard)
  74. Closest Binary Search Tree Value II (Hard)
  75. Closest Subsequence Sum (Hard)
  76. Count Pairs Of Nodes (Hard)
  77. Count the Number of Incremovable Subarrays II (Hard)
  78. Create Maximum Number (Hard)
  79. Find Beautiful Indices in the Given Array II (Hard)
  80. Find K-th Smallest Pair Distance (Hard)
  81. Find Median from Data Stream (Hard)
  82. Get the Maximum Score (Hard)
  83. Last Substring in Lexicographical Order (Hard)
  84. Longest Chunked Palindrome Decomposition (Hard)
  85. Longest Palindrome After Substring Concatenation II (Hard)
  86. Longest Subsequence Repeated k Times (Hard)
  87. Maximum Number of Non-overlapping Palindrome Substrings (Hard)
  88. Maximum Number of Points From Grid Queries (Hard)
  89. Maximum Number of Tasks You Can Assign (Hard)
  90. Maximum Score of a Good Subarray (Hard)
  91. Maximum Total Beauty of the Gardens (Hard)
  92. Minimum Number of Moves to Make Palindrome (Hard)
  93. Minimum Time to Eat All Grains (Hard)
  94. Next Palindrome Using Same Digits (Hard)
  95. Partition Array Into Two Arrays to Minimize Sum Difference (Hard)
  96. Path Existence Queries in a Graph II (Hard)
  97. Recover the Original Array (Hard)
  98. Shortest Matching Substring (Hard)
  99. Subsequence With the Minimum Score (Hard)
  100. Trapping Rain Water (Hard)

Companies that ask two pointers problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics