← All problems

Integer to Roman / Roman to Integer

Medium stringsmathgreedy LeetCode ↗
Convert integers to Roman numerals and Roman numerals back to integers, handling subtractive notation (IV = 4, IX = 9, XL = 40, etc.) correctly in both directions.

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(n), Space O(1)

Common pitfalls

  • Missing subtractive forms
  • Wrong direction in reverse parse

Your solution

Log in to save your code and track progress.