摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use 阅读全文
posted @ 2018-12-26 19:28 fatttcat 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文
posted @ 2018-12-26 17:37 fatttcat 阅读(118) 评论(0) 推荐(0) 编辑
摘要: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2018-12-26 16:23 fatttcat 阅读(122) 评论(0) 推荐(0) 编辑
摘要: Given a string, determine if a permutation of the string could form a palindrome. Example 1: Example 2: Example 3: 扫一遍s,统计频率,奇数频率最多只能出现一次。用cnt表示结果,cnt 阅读全文
posted @ 2018-12-26 16:04 fatttcat 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space? 找中点,反转后半部分,再 阅读全文
posted @ 2018-12-26 11:15 fatttcat 阅读(92) 评论(0) 推荐(0) 编辑
摘要: Remove all elements from a linked list of integers that have value val. Example: time: O(n), space: O(1) 阅读全文
posted @ 2018-12-26 11:06 fatttcat 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
posted @ 2018-12-26 10:22 fatttcat 阅读(66) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You may not modify the values in the list's nodes, only nodes its 阅读全文
posted @ 2018-12-26 10:08 fatttcat 阅读(149) 评论(0) 推荐(0) 编辑