Practice Arena

Python Coding Challenges

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

467 challenges 330 easy 120 medium 17 hard
Python Basics easy

Max of a variable-length list

Implement a function that returns the maximum value from a list of numbers without using max().

conditionals loops comparison
+10 pts 10m
Python Basics easy

Max of three numbers

Implement a function that returns the maximum of three numbers using comparisons.

conditionals comparison numbers
+10 pts 10m
Python Basics easy

Range of values

Calculate the range (max minus min) of a list of numbers. Empty list returns 0.

min max numbers
+10 pts 10m
Strings & Text easy

Longest Word Finder

Write a function that extracts alphabetic words from a string and returns the longest one, with ties broken by earliest position.

strings parsing max
+10 pts 10m
Lists & Arrays medium

Maximum subarray (Kadane)

Find the contiguous subarray with the largest sum.

dp arrays kadane
+25 pts 20m
Lists & Arrays hard

Sliding window maximum

Return the maximum of each window of size k as it slides across an array.

sliding-window deque arrays
+40 pts 35m
Lists & Arrays easy

Running Maximum

Implement a function that returns a list where each element is the largest value seen so far.

lists cumulative maximum
+10 pts 15m
Lists & Arrays easy

Average excluding min and max

Return the average of a list after discarding the lowest and highest elements, handling edge cases.

lists statistics sorting
+7 pts 10m
Lists & Arrays easy

Find Second Largest

Find the second largest unique number in a list, or None if it doesn't exist.

sorting max unique
+10 pts 10m
Lists & Arrays medium

Partition Array

Implement a function that finds a contiguous partition of a list into k groups, minimizing the maximum sum of the groups.

arrays partition contiguous
+25 pts 25m
Data Structures & Algorithms hard

LRU cache decorator

Implement @lru_cache(maxsize=N) for unary functions using OrderedDict.

decorators caching OrderedDict
1
+50 pts 40m
Decorators & Context Managers medium

Rate Limit Decorator

Implement a decorator that enforces a maximum number of calls per second for any function.

decorator time rate-limiting
+20 pts 20m
Dynamic Programming medium

Kadane Variant: Maximum Product Subarray

Implement max_product_subarray(nums) that returns the maximum product of any contiguous subarray.

kadane subarray product
+30 pts 25m
Dynamic Programming medium

Max Profit from Selling Twice

Compute the maximum profit that can be achieved by completing at most two buy-sell transactions on a given price array.

dynamic programming arrays stock
+28 pts 30m
Dynamic Programming easy

House Robber

Given a list of house values, return the maximum sum you can rob without robbing two adjacent houses.

dynamic-programming arrays optimization
+10 pts 15m
Dynamic Programming medium

House Robber Circular

Solve the House Robber problem with houses arranged in a circle.

dynamic-programming arrays circular
+25 pts 30m
Dynamic Programming medium

Maximal square

Given a 2D binary matrix of 0s and 1s, compute the area of the largest square containing only 1s.

dynamic-programming matrix maximal-square
+30 pts 30m
Dynamic Programming medium

0/1 Knapsack

Implement the classic 0/1 Knapsack dynamic programming solution to maximize value under a weight capacity.

dynamic-programming knapsack optimization
+30 pts 25m
Dynamic Programming medium

Unbounded Knapsack

Given item weights and values with unlimited copies, find the maximum total value that fits in a knapsack capacity.

dynamic-programming knapsack optimization
+30 pts 25m
Dynamic Programming medium

Integer Break Product

Given a positive integer n, break it into at least two positive integers that sum to n and maximize their product.

integer-break dynamic-programming max-product
+25 pts 30m
Dynamic Programming medium

Buy Sell Stock with Cooldown (DP)

Given daily stock prices, compute the maximum profit you can achieve if you must wait one day after selling before buying again.

dynamic-programming state-machine stocks
+25 pts 25m
Trees & Binary Trees easy

Maximum depth of tree

Implement max_depth(root) to return the maximum depth of a binary tree.

binary-tree recursion depth
+10 pts 15m
Graphs & Graph Algorithms hard

Minimum Cut

Given an undirected graph in adjacency-list form, return the size of the minimum edge cut that disconnects the graph.

graphs max-flow min-cut
+40 pts 35m
Greedy Algorithms easy

Stock Buy Sell Once

Given daily stock prices, compute the maximum profit you can achieve from buying once and selling once later.

array profit max
+10 pts 15m
Binary Search medium

Ternary Search

Implement ternary search to locate the maximum of a discrete unimodal function.

ternary-search binary-search unimodal
+25 pts 30m
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

Best Time to Buy and Sell Stock

Given a list of daily stock prices, determine the maximum profit achievable by buying on one day and selling on a later day.

arrays sliding-window profit
+10 pts 15m
Matrix & 2D Arrays medium

Max Area of Island

Given a 2D grid of 0s and 1s, find the maximum area of a connected group of 1s.

grid dfs connected-components
+20 pts 25m

Showing 28 challenges

Guide: free Python coding challenges

Practice Python by solving problems

PythonSkillset challenges are hands-on coding exercises from beginner to advanced. Open a challenge, read the problem, write Python in the split-pane editor, and run tests with Pyodide — no install required.

How to use the arena

  1. Pick a category — basics, algorithms, strings, and more
  2. Open a challenge, read the statement, and edit the starter code
  3. Run tests, fix failures, then try a related quiz or tutorial lesson

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.