Question:Givenastringoflowercasecharacters,reorderthemsuchthatthesamecharactersareatleastdistancedfromeachother.Input:{a,b,b},distance=2Output:{b,a,b}http://leetcode.com/2010/05/here-is-another-google-phone-interview.htmlpublicvoidreorder(int[]A,intd)
{
//S..
分类:
其他好文 时间:
2015-01-18 15:51:15
阅读次数:
170
Question:Designamaxstackusingonestack.?Onestack?Ithinkitistwostacks.classMaxMinStack<T>
{
privateStack<T>data;
privateStack<T>max;
privateStack<T>min;
privateComparator<T>comparator;
publicMaxMinStack<T>(Comparatorcompar..
分类:
其他好文 时间:
2015-01-16 17:06:08
阅读次数:
185
Question:Givenanumbern,givemeafunctionthatreturnsthenthfibonaccinumber.Runningtime,spacecomplexity,iterativevs.recursive.http://www.glassdoor.com/Interview/Given-a-number-n-give-me-a-function-that-returns-the-nth-fibonacci-number-Running-time-space-complexi..
分类:
其他好文 时间:
2015-01-16 17:06:01
阅读次数:
105
Question:Givenalistofstring,like(a,b,c),returnalist:(*,*,*),(a,*,*),(*,b,*),(*,*,c),(a,b,*),(a,*,c),(*,b,c),(a,b,c).//NP
publicList<List<String>>generate(List<String>str)
{
//Validations...
List<String>cur=newArrayList<>(str.s..
分类:
其他好文 时间:
2015-01-16 16:57:41
阅读次数:
229
Question:Givennsetsofchoices:(1,2,3),(a,b,c),(i,ii,iii).Youpickoneelementfromeachsetofchoices.Generateallpossiblepickings.http://www.glassdoor.com/Interview/Given-n-sets-of-choices-1-2-3-2-3-4-4-5-You-pick-one-element-from-each-set-of-choices-Generate-all-p..
分类:
其他好文 时间:
2015-01-16 08:46:43
阅读次数:
194
Question:ImplementIntegerdivisionwithoutusing/or%.http://www.glassdoor.com/Interview/Implement-integer-division-without-using-or-Questions-about-running-time-Can-you-do-it-faster-QTN_250205.htm
//Abinaryquestion
//returna/b.
publicintdivide(inta,intb)
{
if(..
分类:
其他好文 时间:
2015-01-16 08:45:05
阅读次数:
154
Question:Inabinaryintegervaluetree,findthelowestlevelcommonancestoroftwovalues.http://www.glassdoor.com/Interview/In-a-binary-integer-value-tree-find-the-lowest-level-common-ancestor-of-two-values-QTN_219955.htm//classTreeNode{
//intval;
//TreeNodeleft;
//T..
分类:
其他好文 时间:
2015-01-16 08:44:40
阅读次数:
190
http://lintcode.com/en/problem/rehashing/#/**
*DefinitionforListNode
*publicclassListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
/**
*@paramhashTable:AlistofThefirstnodeoflinkedlist
*@return:AlistofThefir..
分类:
其他好文 时间:
2015-01-14 18:16:17
阅读次数:
211
http://lintcode.com/en/problem/compare-strings/publicclassSolution{
/**
*@paramA:AstringincludesUpperCaseletters
*@paramB:AstringincludesUpperCaseletter
*@return:ifstringAcontainsallofthecharactersinBreturntrueelsereturnfalse
*/
publicbooleancompareStrings(..
分类:
其他好文 时间:
2015-01-14 18:11:48
阅读次数:
145
http://lintcode.com/en/problem/kth-prime-number/#classSolution{
/**
*@paramk:Thenumberk.
*@return:Thekthprimenumberasdescription.
*/
publiclongkthPrimeNumber(intk){
//writeyourcodehere
Queue<Long>q3=newLinkedList<>();
q3.offer(3L);
Queue<Lon..
分类:
其他好文 时间:
2015-01-14 18:08:01
阅读次数:
163