Re: [algogeeks] Re: AMAZON: given col id, print col name in excel

2012-08-16 Thread Wei.QI
@yq, didn't I ask you this question before? On Fri, Aug 10, 2012 at 4:48 PM, yq Zhang zhangyunq...@gmail.com wrote: @shiv, your code is correct go compute the base 26 number. However, this question is not base 26 number obviously. On Wed, Aug 8, 2012 at 4:46 AM, shiv narayan

Re: [algogeeks] one more from amazon

2011-02-06 Thread Wei.QI
public static ArrayListArrayListInteger Partition(int val, int start, int size) { ArrayListArrayListInteger r = new ArrayListArrayListInteger(); if (start * size val) { return null; } if(size == 1) { r.add(new ArrayListInteger()); r.get(0).add(val); return r; } for

Re: [algogeeks] Excel Sheet Question Asked

2011-02-01 Thread Wei.QI
@albert, You need to becareful when doing the divide, because there is no ZERO. (Z - AA not Z-A0). here is the code: public static String ExcelMapIntToStr(int n) { StringBuilder sb = new StringBuilder(); while(n0) { sb.append((char)(('A' - 1) + (n-1)%26 + 1)); n = (n-1)/26; } return

Re: [algogeeks] Re: Amazon Again

2011-01-30 Thread Wei.QI
. This could be solved in liner time. finding a possible start pump use O(n) and prove it use another O(n). -weiq On Sat, Jan 29, 2011 at 9:47 PM, nishaanth nishaant...@gmail.com wrote: @Wei.Qi Can you clarify when your algorithm terminates and also what is the running time of the algorithm

Re: [algogeeks] Re: Amazon Again

2011-01-29 Thread Wei.QI
Starting with any pump A, try to finish the circle, if at pump B that can not reach pump B+1, it means all pumps from A to B can not finish the circle (it will go broke at pump B), then just start with B+1. After go through all the pumps start from some pump, we got an answer. if we go back to

Re: [algogeeks] Re: google written

2011-01-15 Thread Wei.QI
; should not move forward here, } } On Sat, Jan 15, 2011 at 1:55 PM, Jammy xujiayiy...@gmail.com wrote: @Wei Please test you code on cdbbcbbca. I believe it outputs 2 instead of 8. On Jan 14, 4:09 am, Wei.QI qiw...@gmail.com wrote: FindStartIndex(char

Re: [algogeeks] probability

2011-01-14 Thread Wei.QI
x is even number probability 0.9x + x = 1 x = 1/1.9 P(2) = P(4) = P(6) = (1 / 1.9) / 3 P(4|5|6) = (P(4) + P(6)) / 0.75 = 2 / 1.9 / 3 / 0.75 = 0.4678362573099415 -weiq On Thu, Jan 13, 2011 at 11:29 PM, snehal jain learner@gmail.com wrote: An unbalanced dice (with 6 faces, numbered from 1 to

Re: [algogeeks] google written

2011-01-14 Thread Wei.QI
FindStartIndex(char[] a) { int start = 0; int current = 1; while(current a.Length) { if(a[current] a[start]) { start = current; ++current; }else if(a[current] a[start]) { ++current; }else //a[current] ==

Re: [algogeeks] google written

2011-01-14 Thread Wei.QI
@juver++, can you give me a test case that will time out? On Fri, Jan 14, 2011 at 6:44 AM, juver++ avpostni...@gmail.com wrote: @qw I think you solution will timed out?! -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this