>RunTimeFix
BookStudyPracticeInterviewsYouTubeCoursesAbout
Log inGet Started
Topics/Two Pointers & Sliding Window
beginner level

Two Pointers & Sliding Window

Quick Answer

What is Two Pointers & Sliding Window?

Two pointers and sliding window are O(n) techniques that eliminate the need for O(n²) brute force on array and string problems. The two-pointer technique uses two indices moving through data in a coordinated way: opposite-direction pointers for problems like pair sum, same-direction pointers for merging or partitioning. Sliding window maintains a window of elements and slides it across the array: fixed-size for statistics over subarrays, variable-size for finding optimal subarrays satisfying a condition. RunTimeFix teaches both with a template-based approach that makes implementation reliable.

  • two pointers
  • sliding window
  • subarray problems
  • O(n) algorithms
  • opposite direction
  • same direction

Study Material for Two Pointers & Sliding Window

Ch 14: Two Pointers & Sliding Window

Two Pointers (Opposite Direction) · Two Pointers (Same Direction) · Sliding Window (Fixed Size) · Sliding Window (Variable Size)

Related Topics

AlgorithmsBinary SearchCompetitive Programming
Was this helpful?

Published by RunTimeFix · Comprehensive guides for competitive programming

>RunTimeFix

Practical programming education. Books, videos, courses, and hands-on learning for competitive programming, DSA, and software engineering.

RunTimeFix

  • About
  • YouTube
  • Book
  • Study Library
  • Courses

Learn

  • Competitive Programming
  • DSA
  • Development
  • Databases

Legal

  • Privacy
  • Terms
  • Refund Policy

RunTimeFix — debug → solve → run

© 2026 RunTimeFix. All rights reserved.