随笔分类 -  Algorithm

上一页 1 2 3 4 5 6 7 8 ··· 16 下一页
classic algorithm, problem
摘要:Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regu... 阅读全文
posted @ 2015-05-27 01:59 卖程序的小歪 阅读(262) 评论(0) 推荐(0)
摘要:Find all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combination should be a u... 阅读全文
posted @ 2015-05-27 01:07 卖程序的小歪 阅读(167) 评论(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-27 00:23 卖程序的小歪 阅读(224) 评论(0) 推荐(0)
摘要:Find thekth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For exampl... 阅读全文
posted @ 2015-05-25 00:01 卖程序的小歪 阅读(196) 评论(0) 推荐(0)
摘要:# Write your MySQL query statement belowSELECT p.FirstName, p.LastName, a.City, a.State FROM Person AS pLEFT JOIN Address AS a ON p.PersonId = a.Perso... 阅读全文
posted @ 2015-05-22 01:16 卖程序的小歪 阅读(146) 评论(0) 推荐(0)
摘要:# Write your MySQL query statement belowSELECT a.Name FROM Employee AS aINNER JOIN Employee AS b ON a.ManagerId = b.IdWHERE a.Salary > b.Salary让我来看看讨论... 阅读全文
posted @ 2015-05-22 01:01 卖程序的小歪 阅读(157) 评论(0) 推荐(0)
摘要:Given an array ofnpositive integers and a positive integers, find the minimal length of a subarray of which the sum ≥s. If there isn't one, return 0 i... 阅读全文
posted @ 2015-05-14 16:37 卖程序的小歪 阅读(154) 评论(0) 推荐(0)
摘要:There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have to firs... 阅读全文
posted @ 2015-05-14 16:18 卖程序的小歪 阅读(234) 评论(0) 推荐(0)
摘要:1 class TrieNode { 2 public: 3 const static int NR_FANOUT = 26; 4 TrieNode* child[NR_FANOUT]; 5 int count; 6 // Initialize your data ... 阅读全文
posted @ 2015-05-11 21:18 卖程序的小歪 阅读(296) 评论(0) 推荐(0)
摘要:Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl... 阅读全文
posted @ 2015-05-07 08:46 卖程序的小歪 阅读(127) 评论(0) 推荐(0)
摘要:Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a ... 阅读全文
posted @ 2015-05-07 08:26 卖程序的小歪 阅读(152) 评论(0) 推荐(0)
摘要:There are a total ofncourses you have to take, labeled from0ton - 1.Some courses may have prerequisites, for example to take course 0 you have to firs... 阅读全文
posted @ 2015-05-06 22:30 卖程序的小歪 阅读(374) 评论(0) 推荐(0)
摘要:绝对老题了,感觉已经重复了Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you imp... 阅读全文
posted @ 2015-05-06 19:37 卖程序的小歪 阅读(159) 评论(0) 推荐(0)
摘要:Description:Count the number of prime numbers less than a non-negative number,nclick to show more hints.References:How Many Primes Are There?Sieve of ... 阅读全文
posted @ 2015-04-30 10:42 卖程序的小歪 阅读(202) 评论(0) 推荐(0)
摘要:这题居然没有记录,写一下吧:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesa... 阅读全文
posted @ 2015-04-25 17:30 卖程序的小歪 阅读(220) 评论(0) 推荐(0)
摘要:Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6,val= 6Return:1 --> 2 --> 3 --... 阅读全文
posted @ 2015-04-25 09:40 卖程序的小歪 阅读(154) 评论(0) 推荐(0)
摘要:1 class Solution { 2 public: 3 bool isHappy(int n) { 4 int last = n; 5 6 unordered_set exist; 7 8 do { ... 阅读全文
posted @ 2015-04-22 23:45 卖程序的小歪 阅读(194) 评论(0) 推荐(0)
摘要:这个题居然没有记录。原地旋转数组可以见编程珠玑,在JDK代码中也可以找到(Collections.rotate),提供了两种方式一种是做三次reverse,还有一种则是进行遍历替换。第一种方式: 1 class Solution { 2 public: 3 void rotate(int n... 阅读全文
posted @ 2015-04-20 11:02 卖程序的小歪 阅读(205) 评论(0) 推荐(0)
摘要:1 class Solution { 2 private: 3 char tbl[256]; 4 public: 5 vector findRepeatedDnaSequences(string s) { 6 vector res; 7 8 ... 阅读全文
posted @ 2015-04-19 22:17 卖程序的小歪 阅读(152) 评论(0) 推荐(0)
摘要:Given a range [m, n] where 0 >=1; 9 n>>=1;10 }11 return res;12 }13 14 int bitvalue(int m, int n) {15 i... 阅读全文
posted @ 2015-04-16 08:34 卖程序的小歪 阅读(308) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 ··· 16 下一页