![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Two Pointers
Crystal_ting
个人博客 limengting.site
展开
-
287. Find the Duplicate Number / 142. Linked List Cycle II(Java)
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, fi...原创 2017-08-11 20:40:44 · 206 阅读 · 0 评论 -
1. Two Sum/[3]167. Two Sum II - Input array is sorted(C++/Java)
1. Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not u...原创 2017-06-29 23:39:10 · 283 阅读 · 0 评论 -
《剑指offer》链表中倒数第k个节点
题目描述 输入一个链表,输出该链表中倒数第k个结点。 方法一: 思路:倒第k即正第size - k + 1,遍历链表两次,时间复杂度O(n) /* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ ...原创 2018-04-22 00:20:54 · 165 阅读 · 0 评论 -
《剑指offer》两个链表的第一个公共节点
题目描述 输入两个链表,找出它们的第一个公共结点。 根据提交结果来看,只需要考虑无环单链表: /* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class Solution { ...原创 2018-04-27 21:07:26 · 152 阅读 · 0 评论