mm马mm
mm马mm
全部文章
分类
题解(4)
归档
标签
去牛客网
登录
/
注册
mm马mm的博客
全部文章
(共4篇)
题解 | #最长无重复子串#
滑动窗口思想 public int maxLength (int[] arr) { // write code here Map<Integer, Integer> map = new HashMap<>(); int ...
O(n)时间复杂度
滑动窗口思想
2021-04-29
0
464
题解 | #二叉树根节点到叶子节点的所有路径和#
dfs遍历每一个节点,时间复杂度O(n),因为每个节点只遍历一次,空间复杂度取决于递归的深度,最坏为O(n)。 import java.util.*; /* * public class TreeNode { * int val = 0; * TreeNode left = null...
dfs
O(n)时间复杂度
java
2021-04-28
4
929
题解 | #最长递增子序列#
import java.util.*; public class Solution { /** * retrun the longest increasing subsequence * @param arr int整型一维数组 the array * @r...
java
贪心加二分
O(nlgn)时间复杂度
2021-04-27
2
628
题解 | #最小的K个数#
快排思想,平均时间复杂度O(n),最坏时间复杂度O(n2) import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * 将给定数组排序 * ...
O(n)时间复杂度
最小的k个数
快排思想
2021-04-26
0
425