2015年6月7日
摘要: Description:Count the number of prime numbers less than a non-negative number, n. 1 class Solution { 2 public: 3 int countPrimes(int n) { 4 ... 阅读全文
posted @ 2015-06-07 11:42 黄瓜小肥皂 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a string S and a string T, count the number of distinct subsequences of T in S.A subsequence of a string is a new string which is formed from th... 阅读全文
posted @ 2015-06-07 11:07 黄瓜小肥皂 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have t... 阅读全文
posted @ 2015-06-07 10:44 黄瓜小肥皂 阅读(194) 评论(0) 推荐(0) 编辑
  2015年6月6日
摘要: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ... 阅读全文
posted @ 2015-06-06 22:47 黄瓜小肥皂 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example,... 阅读全文
posted @ 2015-06-06 21:21 黄瓜小肥皂 阅读(157) 评论(0) 推荐(0) 编辑
  2015年5月29日
摘要: Implement int sqrt(int x).Compute and return the square root of x. 1 class Solution { 2 public: 3 int mySqrt(int x) { 4 unsigned long long... 阅读全文
posted @ 2015-05-29 17:20 黄瓜小肥皂 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr... 阅读全文
posted @ 2015-05-29 16:46 黄瓜小肥皂 阅读(274) 评论(0) 推荐(0) 编辑
摘要: Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For examp... 阅读全文
posted @ 2015-05-29 09:29 黄瓜小肥皂 阅读(121) 评论(0) 推荐(0) 编辑
摘要: Sort a linked list using insertion sort. 1 class Solution { 2 public: 3 ListNode* insertionSortList(ListNode* head) { 4 ListNode *newhead=... 阅读全文
posted @ 2015-05-29 07:45 黄瓜小肥皂 阅读(109) 评论(0) 推荐(0) 编辑
  2015年5月25日
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z ... 阅读全文
posted @ 2015-05-25 11:25 黄瓜小肥皂 阅读(183) 评论(0) 推荐(0) 编辑