摘要:
// 获取相交节点 public static Node getNode(Node head1, Node head2) { if (head1 == null || head2 == null) { return null; } // 获取第一个链表的入环节点 Node loop1 = getLo 阅读全文
posted @ 2022-04-19 18:03
言小溪enncy
阅读(39)
评论(0)
推荐(0)
摘要:
public static Node getLoopNode(Node head){ if(head == null || head.next == null){ return null; } // 快慢指针,快指针一定会遇到慢指针 Node n1 = head.next; Node n2 = he 阅读全文
posted @ 2022-04-19 17:04
言小溪enncy
阅读(44)
评论(0)
推荐(0)
摘要:
制作中。。。 阅读全文
posted @ 2022-04-19 16:48
言小溪enncy
阅读(25)
评论(0)
推荐(0)
摘要:
方法1 栈 使用出栈入栈的方法,如果是回文结构,则出栈入栈的顺序肯定一致。 时间复杂度:O(N) 空间复杂度:O(N) public static boolean isPalindrome(Node head) { Stack<Node> stack = new Stack<>(); Node cu 阅读全文
posted @ 2022-04-19 14:43
言小溪enncy
阅读(105)
评论(0)
推荐(0)

浙公网安备 33010602011771号