https://leetcode.com/problems/integer-to-roman/

Given an integer, convert it to a roman numeral.

Input is guaranteed to be within the range from 1 to 3999.

这题就是找字母和数字对应, 尤其注意4, 9 这种情况。

discussion 里的一行代码, 不过需要把 个 十 百的 从0 到 9 都在map 中表示

return M[num/1000] + C[(num%1000)/100] + X[(num%100)/10] + I[num%10];

Can't do it without http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm

results matching ""

    No results matching ""