摘要:
简单题 执行用时 :52 ms, 在所有 python3 提交中击败了53.75%的用户 内存消耗 :13.9 MB, 在所有 python3 提交中击败了5.93%的用户 ——2019.10.17 阅读全文
摘要:
简单题 执行用时 :48 ms, 在所有 python3 提交中击败了74.86%的用户 内存消耗 :13.7 MB, 在所有 python3 提交中击败了5.54%的用户 ——2019.10.17 阅读全文
摘要:
简单题 class Solution: def addBinary(self, a: str, b: str) -> str: s=0 a=list(a) a=a[::-1] for i in range(1,len(a)): s+=int(a[i])*2**i s+=int(a[0]) t=0 b 阅读全文
摘要:
真是不容易。。。 class Solution: def myPow(self, x: float, n: int) -> float: if x==float(1): return 1 if x float(1) : if n%2==1:return -1 else:return 1 if n>= 阅读全文
摘要:
执行用时 :72 ms, 在所有 python3 提交中击败了65.93%的用户 内存消耗 :14.1 MB, 在所有 python3 提交中击败了5.25%的用户 ——2019.10.17 阅读全文
摘要:
还需优化。。。 class Solution: def intToRoman(self, num: int) -> str: memo={'I':1,'IV':4,'V':5,'IX':9,'X':10,'XL':40,'L':50,'XC':90,'C':100,'CD':400,'D':500, 阅读全文
摘要:
动态规划。。。 有待优化。。。 执行用时 :288 ms, 在所有 python3 提交中击败了5.37%的用户 内存消耗 :13.8 MB, 在所有 python3 提交中击败了5.27%的用户 ——2019.10.17 阅读全文
摘要:
简单题: 用栈实现: class Solution: def isValid(self, s: str) -> bool: if s=='': return True if len(s)==1: return False stack=[] i=0 while i<len(s): if s[i] in 阅读全文
摘要:
这道题我还是没思路,看了别人的做法觉得豁然开朗简单明了!!!! 栈: class Solution: def longestValidParentheses(self, s: str) -> int: if not s: return 0 res=[] stack=[] for i in range 阅读全文
摘要:
class Solution(object): def isMatch(self, s, p): """ :type s: str :type p: str :rtype: bool """ #'.' 匹配任意单个字符 #'*' 匹配零个或多个前面的那一个元素 memo=dict()#创建空字典 d 阅读全文