1、两个链表的第一个公共结点 输入两个链表,找出它们的第一个公共结点。 当不存在公共节点时,返回空节点。 思路:让两个指针分别走一遍两个链表,交点就是公共节点: /** * Definition for singly-linked list. * struct ListNode { * int va ...
                            
                            
                                分类:
其他好文   时间:
2020-02-26 18:33:09   
                                阅读次数:
73
                             
                         
                    
                        
                            
                            
                                    Leetcode刷题总结 目前已经刷了50道题,从零开始刷题学到了很多精妙的解法和深刻的思想,因此想按方法对写过的题做一个总结 双指针法 双指针法有时也叫快慢指针,在数组里是用两个整型值代表下标,在链表里是两个指针,一般能实现O(n)的时间解决问题,两个指针的位置一般在第一个元素和第二个元素或者第一 ...
                            
                            
                                分类:
其他好文   时间:
2019-08-11 14:56:00   
                                阅读次数:
92
                             
                         
                    
                        
                            
                            
                                    Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in ...
                            
                            
                                分类:
其他好文   时间:
2019-05-14 09:33:27   
                                阅读次数:
113
                             
                         
                    
                        
                            
                            
                                    目录 链表的增删(不带头结点) 栈(链表应用) 链表相关面试题 合并两个有序链表 单链表原地逆置 找出链表的倒数第四个节点 找出链表的中间节点 判断单链表是否有环 求链表交点 删除有序单链表中重复的元素 链表按奇数、偶数值拆分 二叉树层次建树 利用队列动态实现二叉树层次建树 ( ) 链表的增删(不带 ...
                            
                            
                                分类:
编程语言   时间:
2019-04-07 14:23:09   
                                阅读次数:
162
                             
                         
                    
                        
                            
                            
                                Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A:          a1 → a2
                   ↘
              ...
                            
                            
                                分类:
其他好文   时间:
2015-06-20 11:59:16   
                                阅读次数:
129
                             
                         
                    
                        
                            
                            
                                Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists: 
A:          a1 → a2
                   ↘
             ...
                            
                            
                                分类:
其他好文   时间:
2015-05-15 09:13:01   
                                阅读次数:
100
                             
                         
                    
                        
                            
                            
                                Write a program to find the node at which the intersection of two singly linked lists begins.
For example, the following two linked lists:
A:          a1 → a2
                   ↘
              ...
                            
                            
                                分类:
其他好文   时间:
2014-12-03 21:35:50   
                                阅读次数:
118