Leetcode
Yao_tc
这个作者很懒,什么都没留下…
展开
-
69. Sqrt(x)
题目 https://leetcode.com/problems/sqrtx/description/好笨的方法:class Solution: def mySqrt(self, x): """ :type x: int :rtype: int """ if 0 < x and ( x ...原创 2018-06-29 14:52:40 · 138 阅读 · 0 评论 -
66. Plus One
题目 https://leetcode.com/problems/plus-one/description/丑陋的代码:class Solution: def plusOne(self, digits): """ :type digits: List[int] :rtype: List[int] """ ...原创 2018-06-29 01:34:56 · 149 阅读 · 0 评论 -
58. Length of Last Word
题目 https://leetcode.com/problems/length-of-last-word/description/本来以为一句话就解决了:return len(s.split(' ')[-1])。。结果有点头晕。。class Solution: def lengthOfLastWord(self, s): """ ...原创 2018-06-29 00:34:17 · 116 阅读 · 0 评论 -
38. Count and Say
题目 https://leetcode.com/problems/count-and-say/description/class Solution: def countAndSay(self, n): &quot;&quot;&quot; :type n: int :rtype: str 1 11 21 ...原创 2018-06-28 20:44:52 · 114 阅读 · 0 评论 -
35. Search Insert Position
题目描述Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the ar...原创 2018-06-28 19:41:18 · 149 阅读 · 0 评论 -
83. Remove Duplicates from Sorted List
题目 https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/# Definition for singly-linked list.# class ListNode:# def __init__(self, x):# self.val = x# ...原创 2018-06-29 21:24:44 · 142 阅读 · 0 评论 -
70. Climbing Stairs
题目 https://leetcode.com/problems/climbing-stairs/description/if n <= 1: return 1 if n == 2: return 2 if n > 2: return Solution().climbSt...原创 2018-06-29 17:45:53 · 144 阅读 · 0 评论 -
67. Add Binary
题目 https://leetcode.com/problems/add-binary/description/天秀class Solution: def addBinary(self, a, b): """ :type a: str :type b: str :rtype: str """ ..原创 2018-06-29 16:27:39 · 131 阅读 · 0 评论 -
28. Implement strStr()
题目:https://leetcode.com/problems/implement-strstr/description/解决方案class Solution: def strStr(self, haystack, needle): """ :type haystack: str :type needle: str ...原创 2018-06-29 01:54:44 · 130 阅读 · 0 评论