Junior
Integer in Roman notation
livecode
Task condition
Given an integer num in the range from 1 to 3999. Convert it to a Roman numeral string according to the following rules:
mathematica Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000
Subtractive notation rules: 4 is written as IV (5 − 1) 9 as IX (10 − 1) 40 as XL (50 − 10) 90 as XC (100 − 10) 400 as CD (500 − 100) 900 as CM (1000 − 100)
The conversion should consider the place value (units, tens, hundreds, thousands).
Input: num = 3749 Output: "MMMDCCXLIX"
Input: num = 58 Output: "LVIII"
Input: num = 1994 Output: "MCMXCIV"
class Solution {
public String intToRoman(int num) {
}
}