 All Problems
Integer to Roman
medium
math
string
amazon
google
bloomberg

Given an integer, convert it to a roman numeral.

Roman numerals are formed by appending the conversions of decimal place values from highest to lowest. Subtractive cases: 4→IV, 9→IX, 40→XL, 90→XC, 400→CD, 900→CM.

Example 1:

Input: num = 3749
Output: "MMMDCCXLIX"

Example 2:

Input: num = 58
Output: "LVIII"

Constraints: 1 <= num <= 3999

Run to check your code against the sample cases, or submit to run every case