Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

819 challenges 506 easy 280 medium 33 hard
Two Pointers & Sliding Window medium

Container With Most Water

Given an array of heights, find the maximum area between two vertical lines that can hold water.

two-pointers array maximization
+20 pts 25m
Two Pointers & Sliding Window easy

Longest Substring Without Repeating Characters

Implement a function that returns the length of the longest substring without repeating characters.

strings sliding-window two-pointers
+10 pts 15m
Two Pointers & Sliding Window hard

Subarrays with K different ints

Count the number of contiguous subarrays that contain exactly K distinct integers.

sliding-window two-pointers hashmap
+40 pts 40m
Two Pointers & Sliding Window medium

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.

sliding-window two-pointers array
+25 pts 30m
Two Pointers & Sliding Window medium

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.

sliding-window two-pointers hash-map
+25 pts 25m
Two Pointers & Sliding Window medium

Binary Subarray with Sum

Given a binary list and a goal sum, count the number of subarrays that add up to that goal.

sliding-window two-pointers subarray
+20 pts 20m
Two Pointers & Sliding Window medium

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.

sliding-window strings hash-map
+25 pts 20m
Two Pointers & Sliding Window easy

Container With Most Water

Compute the maximum area between two vertical lines in an array of heights.

two-pointers array area-calculation
+15 pts 15m

Showing 8 challenges · 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.