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
Lists & Arrays easy

Two Sum

Return indices (i, j) with i < j such that nums[i] + nums[j] == target.

dict complement
+18 pts 16m
Lists & Arrays easy

Remove duplicates (sorted)

Return a sorted list with duplicates removed.

arrays two-pointer
+10 pts 10m
Lists & Arrays easy

Merge two sorted arrays

Merge two sorted arrays into one sorted array.

arrays merge two-pointer
+12 pts 12m
Lists & Arrays easy

Running Product of Integers

Given a list of integers, return a new list where each element at index i is the product of all elements from index 0 to i.

prefix product lists
+10 pts 10m
Lists & Arrays easy

Second Largest Unique Value

Return the second largest distinct integer from a list, or None if it doesn't exist.

sorting unique arrays
+10 pts 10m
Lists & Arrays easy

Move Zeros to the End

Reorder a list in-place, pushing all zeros to the end while preserving the order of non-zero numbers.

lists in-place two-pointer
+10 pts 15m
Lists & Arrays easy

Chunk a list into n-sized parts

Write a function that divides a list into sublists of at most n elements.

list chunking slicing
+10 pts 15m
Lists & Arrays easy

Rotate Left by k

Implement a function that rotates a list left by k positions.

rotation lists slicing
+10 pts 15m
Lists & Arrays easy

Find Missing Number 1 to n

Given a list containing n-1 distinct integers from 1 to n, find the missing number without using extra space.

arrays math search
+10 pts 10m
Lists & Arrays easy

Interleave Two Lists

Write a function that interleaves two lists element by element, preserving order.

lists merge indexing
+10 pts 10m
Lists & Arrays easy

Keep only even indexes

Given a list, return a new list containing only the elements at even indices (0, 2, 4, ...).

list slicing indexing
+5 pts 5m
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

Difference of Consecutive Elements

Given a list of numbers, return a new list where each element is the difference between consecutive elements.

list iteration math
+8 pts 10m
Lists & Arrays easy

All Unique Values Keep Order

Remove duplicates from a list, keeping only the first occurrence of each value while preserving relative order.

deduplicate order list
+10 pts 15m
Lists & Arrays easy

Insert into a Sorted List

Implement a function that inserts a value into a sorted list at the correct position using binary search.

lists binary-search insertion
+10 pts 10m
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

Zip lists into pairs

Write a function that takes two lists and returns a list of two-element sublists pairing elements by index up to the shortest length.

zip lists pairs
+7 pts 10m
Lists & Arrays easy

Longest Run of Equal Values

Compute the length of the longest run (consecutive block) of equal elements in a list.

lists consecutive run-length
+8 pts 10m
Lists & Arrays easy

Middle Element of an Odd-Length List

Implement a function that returns the middle element of an odd-length list.

lists indexing basic
+5 pts 5m
Lists & Arrays easy

Is Subset of Another List

Write a function that returns True if every element in a given list exists in another list, ignoring duplicates.

subset membership lists
+8 pts 12m
Lists & Arrays easy

Unzip pairs into two lists

Write a function that takes a list of pairs and returns two separate lists: first elements and second elements.

zip unpacking lists
+10 pts 10m
Lists & Arrays easy

Generate a Multiplication Table

Build a function that returns an n x n multiplication table as a list of lists.

nested-loops list-comprehension matrix
+10 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 easy

Move Zeros to End

Rearrange a list by moving all zeros to the end while preserving the relative order of non-zero elements.

list in-place two-pointer
+10 pts 15m
Lists & Arrays easy

Majority Element Finder

Implement a function that returns the majority element in a list, which appears more than half the time.

majority frequency arrays
+10 pts 15m
Lists & Arrays easy

Intersection of Two Lists

Given two lists, return a sorted list of unique elements that appear in both lists.

intersection sorting unique
+10 pts 15m
Lists & Arrays easy

Union of Two Lists

Implement a function that combines two lists and returns only unique elements.

union list set
+10 pts 15m
Lists & Arrays easy

Difference of Two Lists

Write a function that returns items in list a that are not in list b, preserving order and duplicates.

lists difference counting
+8 pts 10m
Lists & Arrays easy

Chunk list into groups

Implement a function that splits a list into sublists of a given size.

list slicing chunking
+10 pts 10m
Lists & Arrays easy

Zip Two Lists

Write a function that pairs elements from two lists by index, stopping at the shorter list.

zip lists pairs
+8 pts 10m
Lists & Arrays easy

Rearrange Positives and Negatives

Write a function that rearranges a list in-place so all negative numbers come before non-negative numbers.

in-place two-pointers partition
+10 pts 15m
Lists & Arrays easy

Wave sort array

Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.

sorting swap rearrangement
+10 pts 15m
Lists & Arrays easy

Last occurrence index

Implement a function that returns the last index of a given value in a list, or -1 if the value is not present.

lists indexing search
+10 pts 10m
Lists & Arrays easy

Counting Sort

Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.

sorting counting arrays
+10 pts 15m

Showing 34 challenges · easy · Lists & Arrays

Lists & Arrays — Python coding challenges

What you will find here

This page lists lists & arrays 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.