摘要: 给你一个链表的头节点 head 和一个整数 val ,请你删除链表中所有满足 Node.val == val 的节点,并返回 新的头节点 。 示例 1: 输入:head = [1,2,6,3,4,5,6], val = 6输出:[1,2,3,4,5] 解题思路: 借助dummy node。 这个题用 阅读全文
posted @ 2021-08-28 18:59 sherry001 阅读(27) 评论(0) 推荐(0)
摘要: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文
posted @ 2021-08-28 13:35 sherry001 阅读(49) 评论(0) 推荐(0)
摘要: 给你单链表的头节点 head ,请你反转链表,并返回反转后的链表。 Input: head = [1,2,3,4,5] Output: [5,4,3,2,1] /** * Definition for singly-linked list. * public class ListNode { * i 阅读全文
posted @ 2021-08-28 11:32 sherry001 阅读(36) 评论(0) 推荐(0)