swaaaay
swaaaay
全部文章
分类
未归档(36)
题解(78)
归档
标签
去牛客网
登录
/
注册
swaaaay的博客
TA的专栏
112篇文章
4人订阅
题解-数据结构与算法
47篇文章
689人学习
题解-SQL
29篇文章
489人学习
每天一道面试题
36篇文章
1432人学习
全部文章
(共112篇)
题解 | #二叉树的最大深度#
来自专栏
class Solution: def maxDepth(self , root: TreeNode) -> int: if not root: return 0 left_len=self.maxDepth(root.left)+1 r...
Python3
2022-03-16
0
392
题解 | #求二叉树的层序遍历#
来自专栏
class Solution: def levelOrder(self , root: TreeNode) -> List[List[int]]: if not root:return [] ans,que = [],[root] # 遍...
Python3
2022-03-16
0
475
题解 | #二叉树的后序遍历#
来自专栏
class Solution: def postorderTraversal(self , root: TreeNode) -> List[int]: ans=[] def postorder(root): if not root...
Python3
2022-03-16
0
352
题解 | #二叉树的前序遍历#
来自专栏
class Solution: def preorderTraversal(self , root: TreeNode) -> List[int]: ans=[] def preorder(root): if not root: ...
Python3
2022-03-16
0
358
题解 | #二叉树的中序遍历#
来自专栏
class Solution: def inorderTraversal(self , root: TreeNode) -> List[int]: ans = [] def inorder(root): if not root: ...
Python3
2022-03-16
0
401
题解 | #旋转数组#
来自专栏
class Solution: def solve(self , n: int, m: int, a: List[int]) -> List[int]: if m==0 or not a or len(a)==1 : return a for _ in ...
Python3
2022-03-16
0
330
题解 | #删除链表的倒数第n个节点#
来自专栏
class Solution: def removeNthFromEnd(self , head: ListNode, n: int) -> ListNode: if not head: return None mark,mark.next,node=L...
Python3
2022-03-16
0
413
题解 | #有效括号序列#
来自专栏
class Solution: def isValid(self , s: str) -> bool: if not s: return False if len(s)%2!=0: return False match,mark={')'...
Python3
2022-03-16
0
398
题解 | #汽水瓶#
来自专栏
def get_ans(n): ans=0 if n<2:return 0 elif n==2:return 1 else: ch = n // 3 # 可换的瓶子 a = n // 3 + n % 3 # 换完后的空瓶 ...
Python3
2022-02-28
0
348
题解 | #简单密码#
来自专栏
def get_ans(s): low_match,ans={'a':'2','b':'2','c':'2', 'd':'3','e':'3','f':'3', 'g':'4','h':'4','i':'4', 'j':'5','k':'...
Python3
2022-02-28
0
438
首页
上一页
1
2
3
4
5
6
7
8
9
10
下一页
末页