Integer to Roman

Seven different symbols represent Roman numerals with specific values: I (1), V (5), X (10), L (50), C (100), D (500), M (1000). Roman numerals are formed by appending the conversions of decimal place values from highest to lowest. If an input value starts with 4 or 9, the subtractive form is used. Powers of 10 (I, X, C, M) can be appended consecutively at most 3 times.

Constraints

  • 1 <= num <= 3999
Saving… · 2 lines
class Solution:
def integerToRoman(self, num: int) -> str:
Console

Click Run to execute sample tests.