- 博客(24)
- 资源 (3)
- 收藏
- 关注
原创 python写算法题:leetcode: 27. Remove Element
https://leetcode.com/problems/remove-element/#/descriptionclass Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :
2017-06-29 21:51:45 257
原创 python写算法题:leetcode: 26. Remove Duplicates from Sorted Array
https://leetcode.com/problems/remove-duplicates-from-sorted-array/#/descriptionclass Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtyp
2017-06-29 21:49:12 207
原创 python写算法题:leetcode: 25. Reverse Nodes in k-Group
https://leetcode.com/problems/reverse-nodes-in-k-group/#/descriptionclass Solution(object): def reverseNode(self, nodes, k): for ind in xrange(k): node = nodes
2017-06-29 21:29:51 283
原创 python写算法题:leetcode: 24. Swap Nodes in Pairs
https://leetcode.com/problems/swap-nodes-in-pairs/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.nex
2017-06-19 00:10:23 219
原创 python写算法题:leetcode: 23. Merge k Sorted Lists
https://leetcode.com/problems/merge-k-sorted-lists/#/descriptionclass Solution(object): def mergeKLists(self, lists): """ :type lists: List[ListNode] :rtype: ListNode
2017-06-18 23:33:26 581
原创 python写算法题:leetcode: 22. Generate Parentheses
class Solution(object): def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ if n<1: return [] braces=set() braces.add('
2017-06-15 12:03:25 331
原创 python写算法题:leetcode: 21. Merge Two Sorted Lists
https://leetcode.com/problems/merge-two-sorted-lists/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x# self.
2017-06-13 11:25:43 628
原创 python写算法题:leetcode: 20. Valid Parentheses
https://leetcode.com/problems/valid-parentheses/#/descriptionclass Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ stab='(){}[
2017-06-13 11:03:48 341
原创 python写算法题:leetcode: 19. Remove Nth Node From End of List
https://leetcode.com/problems/remove-nth-node-from-end-of-list/#/description# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x):# self.val = x#
2017-06-13 02:35:14 324
原创 python写算法题:leetcode: 18. 4Sum
https://leetcode.com/problems/4sum/#/descriptionclass Solution(object): def twoSum(self, nums, target, v): ind=0 ind2=len(nums)-1 res=[] while ind<ind2:
2017-06-13 02:11:31 373
原创 python写算法题:leetcode: 17. Letter Combinations of a Phone Number
https://leetcode.com/problems/letter-combinations-of-a-phone-number/#/descriptionclass Solution(object): def letterCombinations(self, digits): """ :type digits: str :rt
2017-06-13 01:45:12 273
原创 python写算法题:leetcode: 16. 3Sum Closest
https://leetcode.com/problems/3sum-closest/#/descriptionclass Solution(object): def match(self, nums, ind0, target, res): ind1=ind0+1 ind2=len(nums)-1 minv=abs(target-r
2017-06-13 01:19:12 242
原创 python写算法题:leetcode: 15. 3Sum
https://leetcode.com/problems/3sum/#/descriptionclass Solution(object): def match(self, nums, ind0): ind1=ind0+1 ind2=len(nums)-1 res=[] while ind1ind1:
2017-06-12 23:02:44 304
原创 python写算法题:leetcode: 14. Longest Common Prefix
https://leetcode.com/problems/longest-common-prefix/#/descriptionclass Solution(object): def longestCommonPrefix(self, strs): """ :type strs: List[str] :rtype: str
2017-06-12 17:54:56 387
原创 python写算法题:leetcode: 13. Roman to Integer
https://leetcode.com/problems/roman-to-integer/#/descriptionclass Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ romanMap =
2017-06-12 17:26:34 497
原创 python写算法题:leetcode: 12. Integer to Roman
https://leetcode.com/problems/integer-to-roman/#/descriptionclass Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """
2017-06-12 15:50:49 359
原创 python写算法题:leetcode: 11. Container With Most Water
https://leetcode.com/problems/container-with-most-water/#/descriptionclass Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int
2017-06-12 12:44:51 347
原创 python写算法题:leetcode: 10. Regular Expression Matching
https://leetcode.com/problems/regular-expression-matching/#/descriptionclass Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bo
2017-06-12 12:40:16 388
原创 python写算法题:leetcode: 9. Palindrome Number
class Solution(object): def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x<0: return False base=1 while x>=base*10:
2017-06-11 22:28:39 549
原创 python写算法题:leetcode: 8. String to Integer (atoi)
https://leetcode.com/problems/string-to-integer-atoi/#/descriptionclass Solution(object): def myAtoi(self, str): """ :type str: str :rtype: int """
2017-06-11 02:17:26 347
原创 python写算法题:leetcode: 7. Reverse Integer
https://leetcode.com/problems/reverse-integer/#/descriptionclass Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ sign=x<0
2017-06-11 02:15:20 378
原创 python写算法题:leetcode: 6. ZigZag Conversion
https://leetcode.com/submissions/detail/75938758/class Solution(object): def convert(self, s, numRows): """ :type s: str :type numRows: int :rtype: str
2017-06-11 02:04:36 404
原创 python写算法题:leetcode: 5. Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/#/descriptionclass Solution(object): def palindrome(self, s, centpos): ind0=0 while True: if centpos-ind
2017-06-02 08:52:47 320
原创 python写算法题:leetcode: 4. Median of Two Sorted Arrays
https://leetcode.com/problems/median-of-two-sorted-arrays/#/descriptionclass Solution(object): def findPos(this,n1,pos1,n2,pos2,pos): limit1=len(n1) limit2=len(n2) p=0
2017-06-01 02:55:27 250
gameboy advanced for motorola
2008-04-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人