學習路線/陣列與雜湊

12. 整數轉羅馬數字

Medium

Integer to Roman

GreedyMath
返回題目列表

LeetCode 12

Integer to Roman

速度
Variables
剩餘數值 (num)
1994
結果字串 (result)
""

準備開始!目標將整數 1994 轉換為羅馬數字。

Current Number
1994
Result String
|

數值-符號映射表 (Greedy Table)

M1000
CM900
D500
CD400
C100
XC90
L50
XL40
X10
IX9
V5
IV4
I1
目前指針位置:演算法會嘗試用當前指針的數值去扣除剩餘數字。