![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Math Only
feeeeeeet
这个作者很懒,什么都没留下…
展开
-
Leetcode 7. Reverse Integer
Checking integer overflow and negative number.class Solution { public int reverse(int x) { if(x>-10 && x<10){ return x; } long res=0; int...原创 2018-11-13 03:29:02 · 140 阅读 · 0 评论 -
Leetcode 8. String to Integer
class Solution { public int myAtoi(String str) { long res=0; int flag=-1; int start=-1; for(int i=0;i<str.length();i++){ if(flag==-1 && str.c...原创 2018-11-13 05:07:27 · 83 阅读 · 0 评论 -
Leetcode 9. Palindrome Number
same with Leetcode 7class Solution { public boolean isPalindrome(int x) { if(x<0){ return false; } int num=0; int tmp=x; while(tmp!=0){ ...原创 2018-11-13 05:20:45 · 120 阅读 · 0 评论 -
Leetcode 12. Integer to Roman
class Solution { public String intToRoman(int num) { int[] numArray=new int[]{1000,900,500,400,100,90,50,40,10,9,5,4,1}; String[] romaArray=new String[]{"M","CM","D","CD","C","XC&qu原创 2018-11-13 06:25:09 · 95 阅读 · 0 评论 -
Leetcode 13. Roman to Integer
class Solution { public int romanToInt(String s) { HashMap<Character,Integer> map = new HashMap<Character,Integer>(); map.put('I',1); map.put('V',5); map...原创 2018-11-13 07:55:11 · 91 阅读 · 0 评论 -
Leetcode 31. Next Permutation
Search from behind and find the first two number that are in descending order. Change the second number(of that two number) with the next larger number behind it. (12354 change 3 with 4)Sort the numbe...原创 2018-12-04 11:00:21 · 85 阅读 · 0 评论 -
Leetcode 89. Gray Code
2 solutionsclass Solution: def grayCode(self, n): """ :type n: int :rtype: List[int] """ return map(lambda x:int(x,2),self.gray(n)) def gray(self,n):...原创 2018-12-31 19:36:00 · 100 阅读 · 0 评论