Leetcode:Question12--Integer to Roman

題目描述 題目分析 首先熟悉轉換規則,然後可以使用兩個list存儲對應的映射關係,然後每次從大到小看num是否大於1000,大於900,大於500,若在某個區間的話,就將羅馬數字加進來,num減去相應的數值,直到num爲0 代碼展示 class Solution(object): def intToRoman(self, num): intForm = [1000,900,
相關文章
相關標籤/搜索