摘要: 首先,求链表的长度需要遍历,下面为遍历的代码: //求链表的长度 private int length(ListNode head) { int len = 0; while (head != null) { len++; head = head.next; } return len; } head 阅读全文
posted @ 2021-08-09 11:10 王者级菜鸟 阅读(2359) 评论(1) 推荐(0)