上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要: Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order a... 阅读全文
posted @ 2015-12-24 11:48 dylqt 阅读(197) 评论(0) 推荐(0) 编辑
摘要: Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you ... 阅读全文
posted @ 2015-12-22 11:16 dylqt 阅读(185) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ug... 阅读全文
posted @ 2015-12-21 14:17 dylqt 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ /... 阅读全文
posted @ 2015-12-10 19:49 dylqt 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, flatten it to a linked list in-place. For example,Given 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 ... 阅读全文
posted @ 2015-12-07 10:28 dylqt 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According to the definition of h-index on Wikipedia: "A sci... 阅读全文
posted @ 2015-12-06 19:16 dylqt 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort. /** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode* insertionSortList(str... 阅读全文
posted @ 2015-12-04 20:51 dylqt 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list in O(n log n) time using constant space complexity. 1、使用快排:交换的次数太多,超过时间限制 选择第一个值为基准值,然后比较 #include // Definition for singly-linked list. struct ListNode { int val; st... 阅读全文
posted @ 2015-12-04 18:24 dylqt 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330. Note: The result may be very lar... 阅读全文
posted @ 2015-12-02 20:47 dylqt 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 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, white and blue. Here, we will use the integers 0, ... 阅读全文
posted @ 2015-11-25 16:54 dylqt 阅读(134) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 10 下一页