剑指offer
链表中环的入口结点
相似的企业真题
时间限制:C/C++ 1秒,其他语言2秒
空间限制:C/C++ 64M,其他语言128M
热度指数:388809
本题知识点:
链表
算法知识视频讲解
校招时部分企业笔试将禁止编程题跳出页面,为提前适应,练习时请使用在线自测,而非本地IDE。
题目描述
给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null。
说明:本题目包含复杂数据结构ListNode,
点此查看相关信息
上一题
下一题
登录
/
注册
我的提交
编辑器加载中...
/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } } */ public class Solution { public ListNode EntryNodeOfLoop(ListNode pHead) { } }
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } }; */ class Solution { public: ListNode* EntryNodeOfLoop(ListNode* pHead) { } };
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def EntryNodeOfLoop(self, pHead): # write code here
/* public class ListNode { public int val; public ListNode next; public ListNode (int x) { val = x; } }*/ class Solution { public ListNode EntryNodeOfLoop(ListNode pHead) { // write code here } }
/*function ListNode(x){ this.val = x; this.next = null; }*/ function EntryNodeOfLoop(pHead) { // write code here } module.exports = { EntryNodeOfLoop : EntryNodeOfLoop };
val = $x; } }*/ function EntryNodeOfLoop($pHead) { // write code here }
/*function ListNode(x){ this.val = x; this.next = null; }*/ function EntryNodeOfLoop(pHead) { // write code here }
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def EntryNodeOfLoop(self, pHead): # write code here
package main func EntryNodeOfLoop(pHead *ListNode) *ListNode{ }