![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode
zhangjipinggom
俗人
展开
-
【LeetCode-002】 Add Two Numbers
1. 问题2. 解决办法class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def addTwoNumbers(self, l1, l2): """ :...原创 2018-11-28 22:50:32 · 115 阅读 · 0 评论 -
【LeetCode-009】isParlindrome
1.问题描述:2. 解决办法 class Solution: def isPalindrome(self, x): """ :type x: int :rtype: bool """ if x < 0: return False if len(str(x...原创 2018-12-10 22:15:34 · 101 阅读 · 0 评论 -
【LeetCode-011】ContainMostWater
1. 问题描述2. 解决办法: class Solution: def maxArea(self, height): """ :type height: List[int] :rtype: int """ area_m = 0 for width in range(len(heigh...原创 2018-12-16 22:57:29 · 147 阅读 · 0 评论 -
【LeetCode-020】valid parenthesis
1. 问题描述:2. 解决办法: class Solution(object): def isValid(self, s): """ :type s: str :rtype: bool """ dict_match = {"(": ")", "{": "}", "原创 2018-12-20 23:04:17 · 136 阅读 · 0 评论 -
【LeetCode-005】LongestParlingrome
1. 问题描述:2. 解决办法: class Solution: def longestPalindrome(self, s): """ :type s: str :rtype: str """ if len(s) == 0 or len(s) == 1: return s...原创 2018-12-09 23:33:41 · 123 阅读 · 0 评论 -
【LeetCode-003】Longest Substring Without Repeating Characters
GitHub: https://github.com/zhangjipinggom/LeetCode1. 问题描述:2. 解决办法: class Solution(object): def lengthOfLongestSubstring(self, s): """ :type s: str :rtype: int ...原创 2018-12-06 22:02:07 · 101 阅读 · 0 评论 -
【LeetCode-004】findMedianSortedArrays
1. 问题描述:2. 解决办法:class Solution: def findMedianSortedArrays(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: float """ ...原创 2018-12-07 22:26:43 · 620 阅读 · 0 评论 -
【LeetCode-013】Roman to integer
1. 问题描述:2. 解决办法: class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ # a more efficient way to define dictionary: ...原创 2018-12-01 10:13:38 · 105 阅读 · 0 评论 -
【LeetCode-012】IntegerToRoman
1. 问题描述:2. 解决办法: class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ roman = "" num_reverse = str(num)[::-1]...原创 2018-12-04 22:58:57 · 81 阅读 · 0 评论 -
【LeetCode-007】reverse interger
1. 问题:2. 解决办法:class Solution(object): def reverse(self, x): """ :type x: int :rtype: int """ if x >= 0: x = int(str(x)[::-1]) el...原创 2018-11-29 09:16:14 · 117 阅读 · 0 评论 -
【code-021】MergeTwoSortedList
1. 问题描述2. 解决办法:# Definition for singly-linked list.class ListNode(object): def __init__(self, x): self.val = x self.next = Noneclass Solution(object): def mergeTwoList...原创 2018-12-21 23:11:08 · 81 阅读 · 0 评论