![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
String Only
feeeeeeet
这个作者很懒,什么都没留下…
展开
-
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 · 88 阅读 · 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 · 95 阅读 · 0 评论 -
Leetcode 14. Longest Common Prefix
str1.indexOf(str2) The first position that str2 appears in str1. str1.indexOf(str2)!=0 str2 is not the prefix of str1 because str2 doesn’t appear in str1[0]. class Solution { public String long...原创 2018-11-13 08:30:31 · 139 阅读 · 0 评论 -
Leetcode 6. ZigZag Conversion
2 solutions - Sort by Row & Visit by Row Solution 1 Sort by Row Initialize a list contains numRows rows. Iterate through s from left to right and add the character into appropriate row in the lis...原创 2018-11-12 06:08:57 · 97 阅读 · 0 评论 -
Leetcode 65. Valid Number
s=s.strip() delete the space front and end. ‘e’ can only appear after digits and ‘.’ cannot appear after ‘e’. In other words, the character before ‘e’ and after ‘e’ must be both digits. (e3 and 3e ar...原创 2018-12-27 00:38:19 · 119 阅读 · 0 评论 -
Leetcode 68. Text Justification
class Solution: def fullJustify(self, words, maxWidth): """ :type words: List[str] :type maxWidth: int :rtype: List[str] """ res, cur, num_of_l原创 2018-12-27 06:25:04 · 157 阅读 · 0 评论 -
Leetcode 58. Length of Last Word
special case “a b ” class Solution(object): def lengthOfLastWord(self, s): """ :type s: str :rtype: int """ result=0 index=len(s)-1 whi...原创 2018-12-12 07:58:26 · 78 阅读 · 0 评论