摘要:
public static List<List<Integer>> threeSum(int[] nums) { Arrays.sort(nums);/*对数组进行排序*/ List<List<Integer>> lists = new ArrayList<>(); for (int i = 0; 阅读全文
摘要:
这一题很容易想到滑动窗口,但是最难的是如何计算存入连续子数组的数量,(注意是连续的,否则想半天不知道怎么搞,心态炸裂) 代码与解释如下: public int numSubarrayProductLessThanK(int[] nums, int k) { int l=0;/*定义左边界*/ int 阅读全文