DSA SectionEasy

Radix Sort

Detailed guide and Python implementation for the 'Radix Sort' problem.

Problem Statement

Easy

Write a function radix_sort(arr) that sorts a list of non-negative integers arr using the Radix Sort algorithm (using counting sort as the stable sorting subroutine) and returns the sorted list.

Constraints
  • 0 <= len(arr) <= 1000
  • 0 <= arr[i] <= 10^6

Examples

Example 1
Input
arr = [170, 45, 75, 90, 802, 24, 2, 66]
Output
[2, 24, 45, 66, 75, 90, 170, 802]
Explanation

Sorting is performed digit by digit from least significant digit (LSD) to most significant digit (MSD).

Need a Hint?
Consider using Sorting-specific data structures like sets or heaps.
Edge Cases to Watch
  • Empty input structures
  • Single element inputs
  • Large numerical bounds

Ready to Solve?

Open the problem in PyRun's browser-based Python editor. Your code runs fully offline — no server required.

Open in Editor

Recommended Python Resources

Expand your knowledge with related interactive tutorials, cheat sheets, and code comparisons.