米范
米范
全部文章
分类
题解(16)
归档
标签
去牛客网
登录
/
注册
米范的博客
全部文章
(共6篇)
题解 | #机器人的运动范围#
# -*- coding:utf-8 -*- class Solution: def movingCount(self, threshold, rows, cols): &...
Python2
2021-10-13
0
375
题解 | #剪绳子#
1. python 解法 :dp - 动规划。 时间复杂度 O n*log(n) 空间复杂度 O n # -*- coding:utf-8 -*- class Solution: def ...
Go
Python2
Python3
Java
数学
2021-10-11
0
542
题解 | #滑动窗口的最大值#
1.python 解法,可能是所有解法里最短的了吧。。 # -*- coding:utf-8 -*- class Solution: def maxInWindows(self, num,...
Java
Python2
Go
2021-10-08
1
496
题解 | #二叉树的镜像#
1. python3 解法: dfs遍历的同时交换,使用了一个栈没有递归 # class TreeNode: # def __init__(self, x): # ...
Python2
Java
Go
深度优先搜索
广度优先搜索
二叉树
2021-10-08
0
387
题解 | #数据流中的中位数#
python 解法,全部列表里塞,取的时候sort一把。插入的时候时间复杂度为0,取的时候为logN,相比大小顶堆也不错嘛,哈哈。 # -*- coding:utf-8 -*- class Solution: def __init__(self): self.list_num = [] ...
Java
Go
Python2
数组
数学
2021-09-28
0
522
题解 | #二叉搜索树的第k个结点#
1.python 解法,使用栈来统计了,非递归模式: # -*- coding:utf-8 -*- # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # ...
Java
Python2
Go
排序树
2021-09-28
0
391