![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
刷题
nyleve0201
这个作者很懒,什么都没留下…
展开
-
链表中环的入口结点java
给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null。 if (pHead == null || pHead.next == null) return null; ListNode pFast = pHead; ListNode pSlow = pHead; //pFast两步一走,pSlow一步一走,必相遇 while (pFast.next.next != null && pSlow.ne原创 2020-05-20 01:42:24 · 99 阅读 · 0 评论 -
从尾到头打印链表java
@[TOC]链表逆转java 输入一个链表,按链表从尾到头的顺序返回一个ArrayList。 /** * public class ListNode { * int val; * ListNode next = null; * * ListNode(int val) { * this.val = val; * } * } * */ 递归 import java.util.ArrayList; public class原创 2020-05-20 01:07:21 · 142 阅读 · 0 评论