Find Minimum in Rotated Sorted Array
Implement a function that finds the minimum element in a rotated sorted array of distinct integers in O(log n) time.
Subarrays with K different ints
Count the number of contiguous subarrays that contain exactly K distinct integers.
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.
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.
Validate Stack Sequences
Given two sequences of distinct integers, verify whether the second sequence is a valid pop order for a stack given the first sequence as push order.
Number of Islands in a Matrix
Count the number of distinct islands (connected groups of 1s) in a 2D binary matrix.
Second highest salary
Given an employees table, write a SQL query that returns the second highest distinct salary, or NULL if it doesn't exist.
Nth Highest Salary
Write a Python function using SQLite to return the Nth highest distinct salary from an employee table.
Showing 25–32 of 32 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
- Pick a category — basics, algorithms, strings, and more
- Open a challenge, read the statement, and edit the starter code
- 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.