摘要: Given a string, determine if a permutation of the string could form a palindrome.For example,"code"-> False,"aab"-> True,"carerac"-> True.解法一:解题思路:The... 阅读全文
posted @ 2015-12-21 11:38 Hygeia 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.leetcode上返回类型不太一样,改编一下第三个解法:4mspublic class Solution {... 阅读全文
posted @ 2015-12-21 10:53 Hygeia 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list inO(nlogn) time using constant space complexity. 1 /** 2 * 本代码由九章算法编辑提供。没有版权欢迎转发。 3 * - 九章算法致力于帮助更多中国人找到好的工作,教师团队均来自硅谷和国内的一线大公... 阅读全文
posted @ 2015-12-21 09:09 Hygeia 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文
posted @ 2015-12-21 05:33 Hygeia 阅读(153) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort. 1 public class Solution { 2 public ListNode insertionSortList(ListNode head) { 3 ListNode dummy =... 阅读全文
posted @ 2015-12-21 04:14 Hygeia 阅读(158) 评论(0) 推荐(0) 编辑