摘要: 题目链接: https://leetcode-cn.com/problems/reverse-linked-list/ 两种方法: 1.迭代 使用头插法反转链表,代码如下: /** * Definition for singly-linked list. * struct ListNode { * 阅读全文
posted @ 2021-06-19 19:43 SanFranciscoo 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://leetcode-cn.com/problems/palindrome-linked-list/submissions/ 判断一个链表代表的数是否为回文数 1.将链表中的数字复制到数组中,再判断数组是否为回文数 这里不知道链表中有多少个结点,如果创建一个比较大的数组的话,又 阅读全文
posted @ 2021-06-19 18:39 SanFranciscoo 阅读(63) 评论(0) 推荐(0) 编辑