Sponsored Reserved space — layout preview until AdSense is connected
medium +22 pts

Integer to Roman

Greedy subtraction from symbol table.

Implement `to_roman(n: int) -> str`. Use standard subtractive notation (IV = 4, IX = 9, etc.).

Constraints

1 ≤ n ≤ 3999

Example

>>> to_roman(1994)
"MCMXCIV"
22 points ~22 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Build a list of (value, symbol) pairs in descending order; greedily subtract.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.
Sponsored Reserved space — layout preview until AdSense is connected