l1499754436
l1499754436
全部文章
分类
题解(3)
归档
标签
去牛客网
登录
/
注册
l1499754436的博客
全部文章
(共3篇)
题解 | #删除链表的倒数第n个节点#
public static ListNode delN(ListNode pHead, int n) { if (pHead == null || n < 1) { return null; } //统计链表长度 ...
2021-06-28
0
323
题解 | #链表内指定区间反转#
public ListNode reverseBetween2(ListNode head, int m, int n) { // write code here if (m == n) { return head; } ...
2021-06-26
0
264
题解 | #判断链表中是否有环#
逐个删除法: 思路:遍历每个节点,将其自成环,并从链表中删除。在遍历的过程中先判断该节点是否自成环,如已经自成环了,说明之前遍历过这个节点,并将其自成环过。换句话说就是在遍历的过程中先判断 head==head.next,如果相等,说明说环形链表。 public boolean hasCycle(...
2021-06-25
0
371