# Two Pointers DSA Problems

> 217 Two Pointers coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/two-pointers
Last updated: 2026-11-28

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](https://www.internhack.in/learn/dsa/problem/apply-operations-to-an-array) (Easy)
2. [Assign Cookies](https://www.internhack.in/learn/dsa/problem/assign-cookies) (Easy)
3. [Backspace String Compare](https://www.internhack.in/learn/dsa/problem/backspace-string-compare) (Easy)
4. [Check If a Word Occurs As a Prefix of Any Word in a Sentence](https://www.internhack.in/learn/dsa/problem/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence) (Easy)
5. [Check If N and Its Double Exist](https://www.internhack.in/learn/dsa/problem/check-if-n-and-its-double-exist) (Easy)
6. [Check If String Is a Prefix of Array](https://www.internhack.in/learn/dsa/problem/check-if-string-is-a-prefix-of-array) (Easy)
7. [Count Binary Substrings](https://www.internhack.in/learn/dsa/problem/count-binary-substrings) (Easy)
8. [Count Pairs Whose Sum is Less than Target](https://www.internhack.in/learn/dsa/problem/count-pairs-whose-sum-is-less-than-target) (Easy)
9. [Count the Number of Incremovable Subarrays I](https://www.internhack.in/learn/dsa/problem/count-the-number-of-incremovable-subarrays-i) (Easy)
10. [DI String Match](https://www.internhack.in/learn/dsa/problem/di-string-match) (Easy)
11. [Duplicate Zeros](https://www.internhack.in/learn/dsa/problem/duplicate-zeros) (Easy)
12. [Faulty Sensor](https://www.internhack.in/learn/dsa/problem/faulty-sensor) (Easy)
13. [Find All K-Distant Indices in an Array](https://www.internhack.in/learn/dsa/problem/find-all-k-distant-indices-in-an-array) (Easy)
14. [Find First Palindromic String in the Array](https://www.internhack.in/learn/dsa/problem/find-first-palindromic-string-in-the-array) (Easy)
15. [Find Indices With Index and Value Difference I](https://www.internhack.in/learn/dsa/problem/find-indices-with-index-and-value-difference-i) (Easy)
16. [Find the Array Concatenation Value](https://www.internhack.in/learn/dsa/problem/find-the-array-concatenation-value) (Easy)
17. [Find the Distance Value Between Two Arrays](https://www.internhack.in/learn/dsa/problem/find-the-distance-value-between-two-arrays) (Easy)
18. [Find the Index of the First Occurrence in a String](https://www.internhack.in/learn/dsa/problem/find-the-index-of-the-first-occurrence-in-a-string) (Easy)
19. [Flipping an Image](https://www.internhack.in/learn/dsa/problem/flipping-an-image) (Easy)
20. [Happy Number](https://www.internhack.in/learn/dsa/problem/happy-number) (Easy)
21. [Intersection of Two Arrays](https://www.internhack.in/learn/dsa/problem/intersection-of-two-arrays) (Easy)
22. [Intersection of Two Arrays II](https://www.internhack.in/learn/dsa/problem/intersection-of-two-arrays-ii) (Easy)
23. [Intersection of Two Linked Lists](https://www.internhack.in/learn/dsa/problem/intersection-of-two-linked-lists) (Easy)
24. [Is Subsequence](https://www.internhack.in/learn/dsa/problem/is-subsequence) (Easy)
25. [Largest Positive Integer That Exists With Its Negative](https://www.internhack.in/learn/dsa/problem/largest-positive-integer-that-exists-with-its-negative) (Easy)
26. [Lexicographically Smallest Palindrome](https://www.internhack.in/learn/dsa/problem/lexicographically-smallest-palindrome) (Easy)
27. [Linked List Cycle](https://www.internhack.in/learn/dsa/problem/linked-list-cycle) (Easy)
28. [Long Pressed Name](https://www.internhack.in/learn/dsa/problem/long-pressed-name) (Easy)
29. [Merge Sorted Array](https://www.internhack.in/learn/dsa/problem/merge-sorted-array) (Easy)
30. [Merge Strings Alternately](https://www.internhack.in/learn/dsa/problem/merge-strings-alternately) (Easy)
31. [Merge Two 2D Arrays by Summing Values](https://www.internhack.in/learn/dsa/problem/merge-two-2d-arrays-by-summing-values) (Easy)
32. [Middle of the Linked List](https://www.internhack.in/learn/dsa/problem/middle-of-the-linked-list) (Easy)
33. [Minimum Average of Smallest and Largest Elements](https://www.internhack.in/learn/dsa/problem/minimum-average-of-smallest-and-largest-elements) (Easy)
34. [Minimum Common Value](https://www.internhack.in/learn/dsa/problem/minimum-common-value) (Easy)
35. [Move Zeroes](https://www.internhack.in/learn/dsa/problem/move-zeroes) (Easy)
36. [Number of Arithmetic Triplets](https://www.internhack.in/learn/dsa/problem/number-of-arithmetic-triplets) (Easy)
37. [Number of Distinct Averages](https://www.internhack.in/learn/dsa/problem/number-of-distinct-averages) (Easy)
38. [Palindrome Linked List](https://www.internhack.in/learn/dsa/problem/palindrome-linked-list) (Easy)
39. [Remove Duplicates from Sorted Array](https://www.internhack.in/learn/dsa/problem/remove-duplicates-from-sorted-array) (Easy)
40. [Remove Element](https://www.internhack.in/learn/dsa/problem/remove-element) (Easy)
41. [Remove Palindromic Subsequences](https://www.internhack.in/learn/dsa/problem/remove-palindromic-subsequences) (Easy)
42. [Reverse Only Letters](https://www.internhack.in/learn/dsa/problem/reverse-only-letters) (Easy)
43. [Reverse Prefix of Word](https://www.internhack.in/learn/dsa/problem/reverse-prefix-of-word) (Easy)
44. [Reverse String](https://www.internhack.in/learn/dsa/problem/reverse-string) (Easy)
45. [Reverse String II](https://www.internhack.in/learn/dsa/problem/reverse-string-ii) (Easy)
46. [Reverse String Prefix](https://www.internhack.in/learn/dsa/problem/reverse-string-prefix) (Easy)
47. [Reverse Vowels of a String](https://www.internhack.in/learn/dsa/problem/reverse-vowels-of-a-string) (Easy)
48. [Reverse Words in a String III](https://www.internhack.in/learn/dsa/problem/reverse-words-in-a-string-iii) (Easy)
49. [Shortest Distance to a Character](https://www.internhack.in/learn/dsa/problem/shortest-distance-to-a-character) (Easy)
50. [Sort Array By Absolute Value](https://www.internhack.in/learn/dsa/problem/sort-array-by-absolute-value) (Easy)
51. [Sort Array By Parity](https://www.internhack.in/learn/dsa/problem/sort-array-by-parity) (Easy)
52. [Sort Array By Parity II](https://www.internhack.in/learn/dsa/problem/sort-array-by-parity-ii) (Easy)
53. [Squares of a Sorted Array](https://www.internhack.in/learn/dsa/problem/squares-of-a-sorted-array) (Easy)
54. [Strobogrammatic Number](https://www.internhack.in/learn/dsa/problem/strobogrammatic-number) (Easy)
55. [Two Sum III - Data structure design](https://www.internhack.in/learn/dsa/problem/two-sum-iii-data-structure-design) (Easy)
56. [Two Sum IV - Input is a BST](https://www.internhack.in/learn/dsa/problem/two-sum-iv-input-is-a-bst) (Easy)
57. [Two Sum Less Than K](https://www.internhack.in/learn/dsa/problem/two-sum-less-than-k) (Easy)
58. [Valid Palindrome](https://www.internhack.in/learn/dsa/problem/valid-palindrome) (Easy)
59. [Valid Palindrome II](https://www.internhack.in/learn/dsa/problem/valid-palindrome-ii) (Easy)
60. [Valid Word Abbreviation](https://www.internhack.in/learn/dsa/problem/valid-word-abbreviation) (Easy)
61. [3Sum](https://www.internhack.in/learn/dsa/problem/3sum) (Medium)
62. [3Sum Closest](https://www.internhack.in/learn/dsa/problem/3sum-closest) (Medium)
63. [3Sum Smaller](https://www.internhack.in/learn/dsa/problem/3sum-smaller) (Medium)
64. [3Sum With Multiplicity](https://www.internhack.in/learn/dsa/problem/3sum-with-multiplicity) (Medium)
65. [4Sum](https://www.internhack.in/learn/dsa/problem/4sum) (Medium)
66. [Add Two Polynomials Represented as Linked Lists](https://www.internhack.in/learn/dsa/problem/add-two-polynomials-represented-as-linked-lists) (Medium)
67. [Adding Spaces to a String](https://www.internhack.in/learn/dsa/problem/adding-spaces-to-a-string) (Medium)
68. [Advantage Shuffle](https://www.internhack.in/learn/dsa/problem/advantage-shuffle) (Medium)
69. [Append Characters to String to Make Subsequence](https://www.internhack.in/learn/dsa/problem/append-characters-to-string-to-make-subsequence) (Medium)
70. [Bag of Tokens](https://www.internhack.in/learn/dsa/problem/bag-of-tokens) (Medium)
71. [Boats to Save People](https://www.internhack.in/learn/dsa/problem/boats-to-save-people) (Medium)
72. [Camelcase Matching](https://www.internhack.in/learn/dsa/problem/camelcase-matching) (Medium)
73. [Checking Existence of Edge Length Limited Paths](https://www.internhack.in/learn/dsa/problem/checking-existence-of-edge-length-limited-paths) (Hard)
74. [Closest Binary Search Tree Value II](https://www.internhack.in/learn/dsa/problem/closest-binary-search-tree-value-ii) (Hard)
75. [Closest Subsequence Sum](https://www.internhack.in/learn/dsa/problem/closest-subsequence-sum) (Hard)
76. [Count Pairs Of Nodes](https://www.internhack.in/learn/dsa/problem/count-pairs-of-nodes) (Hard)
77. [Count the Number of Incremovable Subarrays II](https://www.internhack.in/learn/dsa/problem/count-the-number-of-incremovable-subarrays-ii) (Hard)
78. [Create Maximum Number](https://www.internhack.in/learn/dsa/problem/create-maximum-number) (Hard)
79. [Find Beautiful Indices in the Given Array II](https://www.internhack.in/learn/dsa/problem/find-beautiful-indices-in-the-given-array-ii) (Hard)
80. [Find K-th Smallest Pair Distance](https://www.internhack.in/learn/dsa/problem/find-k-th-smallest-pair-distance) (Hard)
81. [Find Median from Data Stream](https://www.internhack.in/learn/dsa/problem/find-median-from-data-stream) (Hard)
82. [Get the Maximum Score](https://www.internhack.in/learn/dsa/problem/get-the-maximum-score) (Hard)
83. [Last Substring in Lexicographical Order](https://www.internhack.in/learn/dsa/problem/last-substring-in-lexicographical-order) (Hard)
84. [Longest Chunked Palindrome Decomposition](https://www.internhack.in/learn/dsa/problem/longest-chunked-palindrome-decomposition) (Hard)
85. [Longest Palindrome After Substring Concatenation II](https://www.internhack.in/learn/dsa/problem/longest-palindrome-after-substring-concatenation-ii) (Hard)
86. [Longest Subsequence Repeated k Times](https://www.internhack.in/learn/dsa/problem/longest-subsequence-repeated-k-times) (Hard)
87. [Maximum Number of Non-overlapping Palindrome Substrings](https://www.internhack.in/learn/dsa/problem/maximum-number-of-non-overlapping-palindrome-substrings) (Hard)
88. [Maximum Number of Points From Grid Queries](https://www.internhack.in/learn/dsa/problem/maximum-number-of-points-from-grid-queries) (Hard)
89. [Maximum Number of Tasks You Can Assign](https://www.internhack.in/learn/dsa/problem/maximum-number-of-tasks-you-can-assign) (Hard)
90. [Maximum Score of a Good Subarray](https://www.internhack.in/learn/dsa/problem/maximum-score-of-a-good-subarray) (Hard)
91. [Maximum Total Beauty of the Gardens](https://www.internhack.in/learn/dsa/problem/maximum-total-beauty-of-the-gardens) (Hard)
92. [Minimum Number of Moves to Make Palindrome](https://www.internhack.in/learn/dsa/problem/minimum-number-of-moves-to-make-palindrome) (Hard)
93. [Minimum Time to Eat All Grains](https://www.internhack.in/learn/dsa/problem/minimum-time-to-eat-all-grains) (Hard)
94. [Next Palindrome Using Same Digits](https://www.internhack.in/learn/dsa/problem/next-palindrome-using-same-digits) (Hard)
95. [Partition Array Into Two Arrays to Minimize Sum Difference](https://www.internhack.in/learn/dsa/problem/partition-array-into-two-arrays-to-minimize-sum-difference) (Hard)
96. [Path Existence Queries in a Graph II](https://www.internhack.in/learn/dsa/problem/path-existence-queries-in-a-graph-ii) (Hard)
97. [Recover the Original Array](https://www.internhack.in/learn/dsa/problem/recover-the-original-array) (Hard)
98. [Shortest Matching Substring](https://www.internhack.in/learn/dsa/problem/shortest-matching-substring) (Hard)
99. [Subsequence With the Minimum Score](https://www.internhack.in/learn/dsa/problem/subsequence-with-the-minimum-score) (Hard)
100. [Trapping Rain Water](https://www.internhack.in/learn/dsa/problem/trapping-rain-water) (Hard)

## Companies that ask two pointers problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 77 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 74 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 59 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 54 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 51 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 25 of these problems
- [TCS](https://www.internhack.in/learn/dsa/companies/tcs): 20 of these problems
- [Zoho](https://www.internhack.in/learn/dsa/companies/zoho): 20 of these problems
- [IBM](https://www.internhack.in/learn/dsa/companies/ibm): 20 of these problems
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle): 19 of these problems
- [Accenture](https://www.internhack.in/learn/dsa/companies/accenture): 17 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 17 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)
- [Stack](https://www.internhack.in/learn/dsa/stack) (167)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
