Practice Arena

Python Coding Challenges

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

925 challenges 556 easy 323 medium 46 hard
Stacks & Queues medium

Buildings with ocean view

Given building heights, return sorted indices of buildings that have a clear view of the ocean to their right.

stack monotonic-stack arrays
+20 pts 20m
Stacks & Queues medium

Sum of Subarray Minimums

Given an integer array, sum the minimum of all contiguous subarrays modulo 10^9+7.

stack array monotonic-stack
+30 pts 30m
Stacks & Queues medium

Asteroid Collision

Simulate asteroid collisions with a stack and return the remaining asteroids in original order.

stack simulation arrays
+20 pts 25m
Heaps & Priority Queues medium

Find K pairs with smallest sums

Given two sorted arrays and an integer k, return the k smallest pairs (u, v) with the smallest sums, sorted by sum.

heap priority queue two-sum
+25 pts 30m
Numpy & Vectorized Computing medium

Flatten matrix to vector

Read rows left-to-right, top-to-bottom.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Square each element

Return element-wise squares.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Absolute value per element

Return element-wise absolute values.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Keep positive elements

Return values strictly greater than zero.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Prefix sum vector

Return running totals for each prefix of the vector.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Element-wise multiply

Multiply corresponding elements.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Count non-zero entries

Count elements not equal to zero.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Reverse vector order

Return elements in opposite order.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

Transpose a matrix

Swap rows and columns for a rectangular matrix.

vectors arrays numpy-style
+22 pts 20m
Numpy & Vectorized Computing medium

L2 norm of vector

Return Euclidean length.

vectors arrays numpy-style
+22 pts 20m

Showing 49–62 of 62 challenges · medium

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.