- 博客(8)
- 资源 (2)
- 收藏
- 关注
原创 【LeetCode】725. Split Linked List in Parts
Problem:Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts".The length of each part should be as equal as possible: no tw...
2018-05-09 15:14:07 308 3
原创 【LeetCode】234. Palindrome Linked List
Problem:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?题目:给定一个单链表,判断是否为回文?最好时间复杂度O(n),空间复杂度为 O(1)。 思路:除去要求,最简单的方法则是用stack...
2018-05-05 21:00:24 201
原创 【LeetCode】92. Reverse Linked List II
Problem:Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5...
2018-05-04 16:51:46 128
原创 【LeetCode】19. Remove Nth Node From End of List
Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the li...
2018-05-04 16:35:14 119
原创 【LeetCode】328. Odd Even Linked List
Problem: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 value in the nodes.You should try to do i...
2018-05-04 16:27:50 312
原创 【LeetCode】80. Remove Duplicates from Sorted Array II
Problem:Given a sorted array nums, remove the duplicates in-place such that duplicates appeared at most twice and return the new length.Do not allocate extra space for another array, you must do this ...
2018-05-02 10:45:47 145
原创 【LeetCode】82. Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2->3->3->4->4->5Output: 1->2-&g...
2018-05-02 00:43:39 96
原创 【LeetCode】3. Longest Substring Without Repeating Characters
Problem:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", wi...
2018-05-01 17:15:54 117
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人