Medium · Math

Convert Integer to Roman Numeral

Given an integer num between 1 and 3999, return its standard Roman numeral (symbols I, V, X, L, C, D, M, with the subtractive forms IV, IX, XL, XC, CD and CM).

Examples

Example 1

{
  "num": 1994
}

Output: MCMXCIV

Example 2

{
  "num": 58
}

Output: LVIII

Rebuild it in the studio

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More Math problems