![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
qq_45100750
这个作者很懒,什么都没留下…
展开
-
算法部分:动态规划
题目:最长增长子序列class Solution { public int lengthOfLIS(int[] nums) { if (nums.length==0){ return 0; } int[] result = new int[nums.length]; int max = 0; result[0] = 1; for (int i = 1; i < nums.length;原创 2021-07-05 20:59:36 · 47 阅读 · 0 评论 -
算法部分:快慢指针
先上代码class Solution { public int findDuplicate(int[] nums) { int src = 0,fast = 0,result = 0; while(src!=fast||fast==0){ src = nums[src]; fast = nums[nums[fast]]; } while(result!=src){原创 2021-07-05 12:17:47 · 53 阅读 · 0 评论 -
算法部分:回朔算法
今天刷算法题有一次刷到了回朔算法的题目 出现频率太高了 有必要记录一下public class Test { public static List<List<Integer>> subsets(int[] nums) { List<List<Integer>> lists = new ArrayList<List<Integer>>(); List<Integer> list = n原创 2021-06-23 23:04:10 · 114 阅读 · 0 评论 -
算法部分:利用Comparator排序
今天学刷算法题的时候学会一个排序方法 似乎以前是学过的但我可能忘掉了 重新记录一下先上代码class Solution { public int[][] merge(int[][] intervals) { if (intervals.length == 0) { return new int[0][2]; } Arrays.sort(intervals, new Comparator<int[]>() {原创 2021-06-22 15:55:11 · 193 阅读 · 0 评论