Container With Most Water
Given an array of heights, find the maximum area between two vertical lines that can hold water.
Minimum Size Subarray Sum
Given an array of positive integers, return the minimal length of a contiguous subarray with sum at least target, or 0 if none exists.
Fruit into Baskets
Given an array of integers representing fruit types, return the maximum number of fruits you can collect in a contiguous subarray with at most two distinct types.
Binary Subarray with Sum
Given a binary list and a goal sum, count the number of subarrays that add up to that goal.
Longest Substring with At Most K Distinct Characters
Given a string and an integer k, find the length of the longest substring that contains at most k distinct characters.
Showing 5 challenges · medium · Two Pointers & Sliding Window
Two Pointers & Sliding Window — Python coding challenges
What you will find here
This page lists two pointers & sliding window challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.
Challenges vs tutorials and quizzes
Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.