Majority Element Finder
Implement a function that returns the majority element in a list, which appears more than half the time.
Intersection of Two Lists
Given two lists, return a sorted list of unique elements that appear in both lists.
Union of Two Lists
Implement a function that combines two lists and returns only unique elements.
Difference of Two Lists
Write a function that returns items in list a that are not in list b, preserving order and duplicates.
Chunk list into groups
Implement a function that splits a list into sublists of a given size.
Zip Two Lists
Write a function that pairs elements from two lists by index, stopping at the shorter list.
Rearrange Positives and Negatives
Write a function that rearranges a list in-place so all negative numbers come before non-negative numbers.
Wave sort array
Given a list of integers, reorder it into a wave pattern where elements alternate down-up, and return the new list.
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.
Counting Sort
Implement the counting sort algorithm to sort a list of non-negative integers in O(n + k) time.
Image channel swap
Implement a function that swaps the red and blue channels of an RGB image.
Pad Array Edges
Write a function that pads a list with zeros on both ends.
Move Zeroes
Implement move_zeroes(nums) that in-place moves all zeros to the end while maintaining the order of non-zero elements.
Sort array by parity
Given a list of integers, return a new list with all evens first and odds last, preserving original relative order.
Merge Sorted Array In Place
Write a function that merges two sorted arrays into the first array in-place, keeping the result sorted.
Count Adjacent Pairs
Given a list of integers and a target, count adjacent pairs whose sum equals the target.
Cartesian Product Pairs
Create a function that returns the Cartesian product of two lists as a sorted list of lists.
Reorder list halves
Implement reorder_list(nums) that returns the first half followed by the reversed second half.
Sort List Merge Sort
Write a function that sorts a list of integers using the merge sort algorithm.
Rotate List Right by k
Implement a function that rotates a list to the right by k positions.
Convert Binary Number List
Given a list of bits (0s and 1s) in most-significant-first order, return the equivalent integer value.
Insertion Sort
Implement insertion sort that sorts a list in-place and returns the same list.
Intersection two lists length
Return the number of distinct elements that appear in both input lists.
Running Total Window
Implement a function that returns a list of running totals, resetting to zero after each positive sum.
Showing 25–48 of 57 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.