LeetCode
加油啊DuXY
better and better
展开
-
leetcode-3无重复字符的最长字符串
class Solution: def lengthOfLongestSubstring(self, s: str) -> int: lst = list(s) maxl = 0 sublst = [] for i in lst: if i in sublst: pos = sublst.index(i) sublst = sublst[po.原创 2020-06-02 11:42:42 · 164 阅读 · 0 评论 -
Leecode-面试题64-求1+2+...+n
class Solution: def sumNums(self, n: int) -> int: lst = range(n+1) return sum(lst)这道题整有点蒙原创 2020-06-02 10:51:29 · 195 阅读 · 0 评论 -
leetcode刷题-1、两数之和-Python版
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ for i in range(len(nums)-1): for j in range(i+1,len(nums)): .原创 2020-05-28 10:07:13 · 173 阅读 · 0 评论