摘要:
题目链接 代码 class Solution { public List<Integer> majorityElement(int[] nums) { // 创建返回值 List<Integer> res = new ArrayList<>(); if (nums == null || nums.l 阅读全文
摘要:
题目链接 代码 public int[] maxSlidingWindow(int[] nums, int k) { // 考虑数组中只有一个数 if (nums.length == 0 || k == 0) return new int[0]; // 采用双端队列 Deque<Integer> d 阅读全文
摘要:
题目链接 代码 class Solution { public List<List<Integer>> threeSum(int[] nums) { int n = nums.length; Arrays.sort(nums); List<List<Integer>> ans = new Array 阅读全文