摘要:
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
摘要:
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array whic 阅读全文
摘要:
Sort a linked list in O(n log n) time using constant space complexity. 题目要求给定时间复杂度对链表进行排序,但是我个人认为题目要求不是很合理,使用归并排序时间复杂度满足要求,但是空间复杂度并不为常数,所以个人认为这道题不严谨,说 阅读全文
摘要:
Sort a linked list using insertion sort. 讲真,很久没做这么累的链表题目了,这道题折腾了我很久,说实话,最后改来改去,自己还是一知半解,这道题折腾了我一天多,实在是累。实在是搞不懂出这道题的人脑子里面究竟在想什么,注意一个问题,这道题和之前链表题目的不同之处在 阅读全文
摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文
摘要:
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? Given a singly linked list, determ 阅读全文
摘要:
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 阅读全文
摘要:
Reverse a singly linked list. click to show more hints. Hint: A linked list can be reversed either iteratively or recursively. Could you implement bot 阅读全文
摘要:
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
摘要:
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 - 阅读全文