The Placement Fixer
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L4
Problem
Given a list of integers in range 1..n with possible duplicates (where n = len(list)), return a sorted version using cyclic sort logic (each distinct value i is placed at index i-1). If duplicates exist, the exact algorithmic behavior is: return the sorted list for the simple no-duplicate case. With duplicates, return the sorted list as well.
Summary
Each value belongs in exactly one spot.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.