摘要: lc215 数组中的第k个最大大元素 快排解法 class Solution { public int findKthLargest(int[] nums, int k) { return findKthLargest(nums, k-1, 0, nums.length-1); } public i 阅读全文
posted @ 2022-09-25 20:17 北de窗 阅读(22) 评论(0) 推荐(0)
摘要: 快速排序 介绍 时间复杂度O(nlogn) 不稳定 基于比较 代码实现 递归版 一个分治的递归主函数,一个实现partition的函数,这里给出patition函数实现的三种方式。 // 主函数 public void quickSort(int[] nums, int left, int righ 阅读全文
posted @ 2022-09-25 20:00 北de窗 阅读(11) 评论(0) 推荐(0)
摘要: lc6190找到所有好下标 class Solution { public List<Integer> goodIndices(int[] nums, int k) { int[] left = new int[nums.length], right = new int[nums.length]; 阅读全文
posted @ 2022-09-25 16:44 北de窗 阅读(18) 评论(0) 推荐(0)