摘要: 思路: 1.先对数组排序 2.遍历第一遍求最小绝对值差 3.遍历第二遍填充最小绝对值差的元素对 1 class Solution { 2 public List<List<Integer>> minimumAbsDifference(int[] arr) { 3 int minAbs=Integer 阅读全文
posted @ 2020-01-03 19:45 Chenjin123 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 题意:从给定数组中提取出最长的等差序列(不一定连续),返回它的长度 暴力超时: 1 class Solution { 2 public int longestSubsequence(int[] arr, int difference) { 3 int res=1; 4 for(int i=0;i<a 阅读全文
posted @ 2020-01-03 19:32 Chenjin123 阅读(299) 评论(0) 推荐(0) 编辑