ShannonHung / ShannonHung.github.io

2 stars 0 forks source link

LeetCode #13 Roman to Integer - 刷題之旅 | Shannon's Blog 🐟 技術 | 生活 | 旅行 #99

Open ShannonHung opened 4 months ago

ShannonHung commented 4 months ago

https://shannonhung.github.io/posts/leetcode-13-roman-to-integer/

題目來源:https://leetcode.com/problems/roman-to-integer/description/ 1 題目描述 和上一題相反,將羅馬數字轉換成阿拉伯數字。 2 解法 2.1 我的作法 我一開始想的比較複雜,是想要使用while迴圈,從第一個字串與第二個字串開始比較,一般來說羅馬字是由大排到小,因此一但發現“前面” < "後面“ (由小到大),