swaaaay
swaaaay
全部文章
题解
未归档(36)
归档
标签
去牛客网
登录
/
注册
swaaaay的博客
全部文章
/ 题解
(共76篇)
题解 | #滑动窗口的最大值#
来自专栏
class Solution: def maxInWindows(self , nums: List[int], k: int) -> List[int]: # write code here if not nums or k==0: return []...
Python3
2021-11-12
0
408
题解 | #两个链表的第一个公共结点#
来自专栏
class Solution: def FindFirstCommonNode(self , pHead1 , pHead2 ): # write code here mark1,mark2=pHead1,pHead2 while mark1!...
Python3
链表
2021-11-12
0
339
题解 | #删除链表的节点#
来自专栏
class Solution: def deleteNode(self , head: ListNode, val: int) -> ListNode: # write code here # 极端情况 if not h...
Python3
链表
2021-11-12
0
409
题解 | #名字的漂亮度#
来自专栏
用python字典解决 def get_ans(s): dic={} for item in s: dic[item]=dic.get(item,0)+1 mark=sorted(dic.values(),reverse=True) mark=[mar...
Python3
2021-11-11
0
393
题解 | #统计每个月兔子的总数#
来自专栏
python实现斐波那契数列 def get_ans(s): ans=[0,1,1] if s<=2: return ans[s] for i in range(3,s+1): ans.append(ans[i-1]+ans[i-2]) ...
Python3
2021-11-11
0
313
题解 | #使用join查询方式找出没有分类的电影id以及名称#
来自专栏
select f.film_id, f.title from film f left join film_category fc on f.film_id=fc.film_id left join category c on fc.category_id=c.category_id where c...
Sqlite
2021-11-10
0
401
题解 | #求最大连续bit数#
来自专栏
非常暴力的解法,每遇到一个1则res+1,每遇到一个0则res=0,列表记录res的值,最后返回max(列表) def get_ans(s): ans=[] res=0 mark=str(bin(int(s))) for i in mark: if i...
Python3
2021-11-09
1
480
题解 | #二叉树中和为某一值的路径(一)#
来自专栏
python递归 class Solution: def hasPathSum(self , root: TreeNode, sum: int) -> bool: # write code here if not root: return False ...
Python3
二叉树
递归
2021-11-08
0
349
题解 | #把二叉树打印成多行#
来自专栏
二叉树好难。。。 class Solution: # 返回二维列表[[1,2],[4,5]] def Print(self, pRoot): # write code here if not pRoot:return [] result...
Python3
二叉树
2021-11-08
0
418
题解 | #合并两个排序的链表#
来自专栏
class Solution: def Merge(self, pHead1, pHead2): # write code here cur1,cur2=pHead1,pHead2 '''极端情况''' if not cur1:...
Python3
2021-11-05
1
398
首页
上一页
1
2
3
4
5
6
7
8
下一页
末页