摘要: 141题:判断链表是不是存在环! 142 给定一个链表,返回链表环开始的地方,如果没有环,就返回空。 思路:链表头结点到链表环开始的地方的步数和两个链表相遇的地方到链表开始的地方的步数是一样多的! 阅读全文
posted @ 2018-05-29 00:08 bwwbww 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b+ c + d = target? Find all unique qu 阅读全文
posted @ 2018-05-27 19:40 bwwbww 阅读(69995) 评论(0) 推荐(0) 编辑
摘要: 3Sum Closest Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the s 阅读全文
posted @ 2018-05-27 19:16 bwwbww 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 数组中找三个数和为0的结果集 1 // 解法一:先排序 然后固定一个值 然后用求两个数的和的方式 2 public static List> threeSum(int[] nums) { 3 List> res = new ArrayList(); 4 if (nums.length list = new ArrayList(); 18 ... 阅读全文
posted @ 2018-05-27 19:09 bwwbww 阅读(129) 评论(0) 推荐(0) 编辑