会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Tech Blog Pro
大数据/机器学习/数据挖掘/web开发 计算机世界里的一名小学生
首页
新随笔
联系
订阅
管理
上一页
1
···
5
6
7
8
9
10
11
12
13
···
33
下一页
2019年4月2日
Leetcode 654. Maximum Binary Tree
摘要: # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): ...
阅读全文
posted @ 2019-04-02 18:14 周洋
阅读(164)
评论(0)
推荐(0)
2019年3月30日
Leetcode 1005. Maximize Sum Of Array After K Negations
摘要: class Solution(object): def largestSumAfterKNegations(self, A, K): """ :type A: List[int] :type K: int :rtype: int """ have_zero = False ne...
阅读全文
posted @ 2019-03-30 07:49 周洋
阅读(174)
评论(0)
推荐(0)
Leetcode 1006. Clumsy Factorial
摘要: class Solution(object): def clumsy(self, N): """ :type N: int :rtype: int """ op = {0: '*', 1: '//', 2: '+', 3: '-'} strN = list(map(str, range(N -...
阅读全文
posted @ 2019-03-30 07:00 周洋
阅读(180)
评论(0)
推荐(0)
2019年3月23日
Leetcode 617. Merge Two Binary Trees
摘要: import functools class Solution(object): @functools.lru_cache() def mergeTrees(self, t1, t2): if t1 and t2: root = TreeNode(t1.val + t2.val) root.left = self.m...
阅读全文
posted @ 2019-03-23 18:27 周洋
阅读(117)
评论(0)
推荐(0)
Leetcode 477. Total Hamming Distance
摘要: 按位计算就行.
阅读全文
posted @ 2019-03-23 06:11 周洋
阅读(137)
评论(0)
推荐(0)
python进制转换
摘要: bin(7)Out[12]: '0b111'oct(73)Out[13]: '0o111'hex(273)Out[14]: '0x111'
阅读全文
posted @ 2019-03-23 04:16 周洋
阅读(456)
评论(0)
推荐(0)
Leetcode 461. Hamming Distance
摘要: class Solution(object): def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ return str(bin(x^y)).count('1')
阅读全文
posted @ 2019-03-23 04:07 周洋
阅读(139)
评论(0)
推荐(0)
Leetcode 938. Range Sum of BST
摘要: import functools # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None @functools.l...
阅读全文
posted @ 2019-03-23 02:46 周洋
阅读(252)
评论(0)
推荐(0)
2019年3月22日
Leetcode 28. Implement strStr()
摘要: class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int """ return haystack.find(needle) ...
阅读全文
posted @ 2019-03-22 06:20 周洋
阅读(159)
评论(0)
推荐(0)
Leetcode 459. Repeated Substring Pattern
摘要: class Solution(object): def repeatedSubstringPattern(self, s): return True if re.match(r'(\w+)\1+$', s) else False
阅读全文
posted @ 2019-03-22 01:29 周洋
阅读(174)
评论(0)
推荐(0)
上一页
1
···
5
6
7
8
9
10
11
12
13
···
33
下一页
公告