CodeMosa

Master LeetCode Patterns

5 Problems

Two Pointers Problems

Classic two-pointer problems on sorted arrays, palindromes, and interval merges.

Back to Collections

Relevant Patterns

#
Study these pattern guides before tackling the problems. Understanding the core concepts will help you solve them more efficiently.

Practice Problems

#
Show 2 hints
  • Use a write pointer to compact unique elements in-place.
  • Return the new length; elements beyond it can be ignored.
Show 2 hints
  • Skip non-alphanumeric; compare lowercased characters from both ends.
  • Stop when pointers cross.
Show 2 hints
  • Opposite-end pointers; move the shorter side inward to possibly increase area.
  • Area = min(height[l], height[r]) * (r - l).
Show 2 hints
  • If sum < target move left pointer; if sum > target move right pointer.
  • Return 1-indexed positions as required by the problem.
Medium#15
Show 2 hints
  • Sort first; fix i and run two pointers on (i+1..n-1).
  • Skip duplicates for i, left, and right to avoid repeats.

Track Your Progress

Mark problems as complete as you solve them. Come back anytime to continue where you left off.