前言
链表操作:最开始我也没弄懂,但是这个就是不断的debug这样才能找到更合适的结果。
本题牛网连接:牛网连接
一、代码:
链表类:
@Data
class Node {
private int id;
private Node nextNode;
}
构建链表
public static Node build(int count, Node head) {
Node current = head;
for (int i = 1; i <= count - 1; i++) {
Node next = new Node();
next.setId(i);
current.