摘要: 1.力扣300--最长递增子序列 class Solution { public int lengthOfLIS(int[] nums) { //贪心算法,基本思路:dp数组维护长度为下表i的最长子序列的最后一个值的最小数 int n = nums.length; int[] dp = new in 阅读全文
posted @ 2023-01-23 11:49 lyjps 阅读(18) 评论(0) 推荐(0)
摘要: 1.力扣287--寻找重复数 class Solution { //环形链表2的变形:数组游标是指针,数组中的元素值是该节点指向下一个节点的指针 //该问题可以转化为找到环的入口 public int findDuplicate(int[] nums) { int fast = nums[0], s 阅读全文
posted @ 2023-01-23 11:48 lyjps 阅读(20) 评论(0) 推荐(0)