Leetcode
文章平均质量分 55
记录刷题
炬火埋土
这个作者很懒,什么都没留下…
展开
-
13. Roman to Integer
13. Roman to IntegerSymbol ValueI 1V 5X 10L 50C 100D 500M 1000For example, 2 is written as II in Roman numeral, just two one’s added together. 12 is written原创 2022-03-18 20:30:12 · 233 阅读 · 0 评论 -
9. Palindrome Number
PalindromeAn integer is a palindrome when it reads the same backward as forward.一,第一种方法,分别取出整数的各位数,然后用末尾的数字乘最高位的位数。以121为例,第一次取出个位1,第二次取出十位数字2,将1乘以10加成2.第三次取出百位数字1,将12乘以10加上百位数字1.如果和原来的数字相同。则为回文数。 bool isPalindrome(int x) { if(x<0){原创 2022-03-10 15:20:06 · 197 阅读 · 0 评论