摘要: 题目:26. 删除有序数组中的重复项 解答: 本人思路:再创建一个数组result,然后把nums数组的内容复制到result中,nums数据全部赋值10001(大于10000就行),然后两个数据依次比对(先把nums[0]=result[0]),把不相同的数据加入到nums中即可,最后得到目标数组 阅读全文
posted @ 2023-02-21 13:47 ZLey 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 题目: 16. 最接近的三数之和 class Solution { public int threeSumClosest(int[] nums, int target) { Arrays.sort(nums); //数组排序 int min = Integer.MAX_VALUE; //整数最大值 阅读全文
posted @ 2023-02-21 13:46 ZLey 阅读(12) 评论(0) 推荐(0) 编辑