自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(31)
  • 收藏
  • 关注

原创 Python, LeetCode, 290. 单词模式

class Solution: """ @param pattern: a string, denote pattern string @param str: a string, denote matching string @return: an boolean, denote whether the pattern string and the matching...

2018-05-18 10:24:42 301

原创 Python, LintCode, 391. 数飞机

"""Definition of Interval.class Interval(object): def __init__(self, start, end): self.start = start self.end = end"""class Solution: """ @param airplanes: An interval...

2018-05-17 22:43:47 260

原创 Python, LeetCode, 56. 合并区间

"""Definition of Interval.class Interval(object): def __init__(self, start, end): self.start = start self.end = end"""class Solution: """ @param intervals: interval li...

2018-05-17 20:08:56 798 1

原创 Python, LintCode, 372. Delete Node in a Linked List

"""Definition of ListNodeclass ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next"""class Solution: """ @param: node: the node in ...

2018-05-17 11:31:41 107

原创 Python, LeetCode, 110. 平衡二叉树

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param root: The root of bin...

2018-05-16 17:42:05 349

原创 Python, LintCode, 415. 有效回文串

class Solution: """ @param s: A string @return: Whether the string is a valid palindrome """ def isPalindrome(self, s): # write your code here if s == None: ...

2018-05-16 17:18:12 226

原创 Python, LeetCode, 28. 实现strStr()

class Solution: """ @param: source: source string to be scanned. @param: target: target string containing the sequence of characters to match @return: a index to the first occurrence o...

2018-05-16 15:34:28 242

原创 Python, LeetCode, 67. 二进制求和

class Solution: """ @param a: a number @param b: a number @return: the result """ def addBinary(self, a, b): # write your code here a = list(a) b = list...

2018-05-16 10:27:41 394

原创 Python, LintCode, 433. 岛屿的个数

class Solution: """ @param grid: a boolean 2D matrix @return: an integer """ def numIslands(self, grid): # write your code here if len(grid) == 0 or grid == None: ...

2018-05-13 11:45:21 890

原创 Python, LintCode, 488. 快乐数

class Solution: """ @param n: An integer @return: true if this is a happy number or false """ def isHappy(self, n): # write your code here while True: t...

2018-05-12 11:09:16 286

原创 Python, LeetCode, 88. 合并两个有序数组

class Solution: """ @param: A: sorted integer array A which has m elements, but size of A is m+n @param: m: An integer @param: B: sorted integer array B which has n elements @param...

2018-05-12 10:52:14 475

原创 Python, LeetCode, 26. 删除排序数组中的重复项

class Solution: """ @param: nums: An ineger array @return: An integer """ def removeDuplicates(self, nums): # write your code here i = 0 while i+1 < len(...

2018-05-12 10:21:04 232

原创 Python, LeetCode, 27. 移除元素

class Solution: """ @param: A: A list of integers @param: elem: An integer @return: The new length after remove """ def removeElement(self, A, elem): # write your code ...

2018-05-12 09:50:37 118

原创 Python, LintCode, 41. 最大子数组

class Solution: """ @param nums: A list of integers @return: A integer indicate the sum of max subarray """ def maxSubArray(self, nums): # write your code here if l...

2018-05-12 09:00:43 149

原创 Python, LintCode, 420. 报数

class Solution: """ @param n: the nth @return: the nth sequence """ def countAndSay(self, n): # write your code here if n == 1: return "1" if n ...

2018-05-11 21:56:15 184

原创 Python, LeetCode, 5. 最长回文子串

class Solution: """ @param s: input string @return: the longest palindromic substring """ def longestPalindrome(self, s): # write your code here res = "" if...

2018-05-10 22:48:29 310

原创 Python, LintCode, 627. 最长回文串

class Solution: """ @param s: a string which consists of lowercase or uppercase letters @return: the length of the longest palindromes that can be built """ def longestPalindrome(s...

2018-05-10 11:04:12 135

原创 Python, LeetCode, 9. 回文数

class Solution: """ @param num: a positive number @return: true if it's a palindrome or false """ def isPalindrome(self, num): # write your code here s = str(num) ...

2018-05-10 10:48:28 114

原创 Python, LeetCode, 21. 合并两个有序链表

"""Definition of ListNodeclass ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next"""class Solution: """ @param l1: ListNode l1 is th...

2018-05-10 10:41:03 99

原创 Python, LintCode, 111. 爬楼梯

class Solution: """ @param n: An integer @return: An integer """ def climbStairs(self, n): # write your code here res = [0, 1, 2] if n <= 2: ...

2018-05-10 10:17:19 171

原创 Python, LeetCode, 66. 加一

class Solution: """ @param digits: a number represented as an array of digits @return: the result """ def plusOne(self, digits): # write your code here car = 1 ...

2018-05-10 10:04:35 183

原创 Python, LeetCode, 20. 有效的括号

class Solution: """ @param s: A string @return: whether the string is a valid parentheses """ def isValidParentheses(self, s): # write your code here N = len(s) ...

2018-05-09 19:36:00 195

原创 Python, LintCode, 46. Majority Element

class Solution: """ @param: nums: a list of integers @return: find a majority number """ def majorityNumber(self, nums): # write your code here if len(nums) == 0:...

2018-05-09 18:56:37 145

原创 Python, LintCode, 35. 翻转链表

"""Definition of ListNodeclass ListNode(object): def __init__(self, val, next=None): self.val = val self.next = next"""class Solution: """ @param head: n @return...

2018-05-09 18:45:40 187

原创 Python, LeetCode, 3. 无重复字符的最长子串

class Solution: """ @param: s: a string @return: an integer """ def lengthOfLongestSubstring(self, s): # write your code here res = 0 if s is None or len(s)...

2018-05-09 17:40:47 149

原创 Python, LintCode, 88. Lowest Common Ancestor of a Binary Tree

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param: root: The root of t...

2018-05-03 21:10:51 132

原创 Python, LintCode, 453. 将二叉树拆成链表

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param root: a TreeNode, the...

2018-05-03 11:58:06 154

原创 Python, LintCode, 480. 二叉树的所有路径

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param root: the root of the...

2018-05-03 10:32:04 288

原创 Python, LintCode, 469. Same Tree

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param a: the root of binary...

2018-05-03 09:36:27 126

原创 Python, LintCode, 175. 翻转二叉树

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param root: a TreeNode, the...

2018-05-02 19:12:45 209 1

原创 Python, LintCode, 375. 克隆二叉树

"""Definition of TreeNode:class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None"""class Solution: """ @param root: The root of bin...

2018-05-02 18:30:19 272

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除