@yq, didn't I ask you this question before?
On Fri, Aug 10, 2012 at 4:48 PM, yq Zhang 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
> wrote:
>>
>> this is similar
public static ArrayList> Partition(int val, int start,
int size) {
ArrayList> r = new ArrayList>();
if (start * size > val) {
return null;
}
if(size == 1)
{
r.add(new ArrayList());
r.get(0).add(val);
return r;
}
for (int i = start; i <= val/size; i++) {
ArrayList>
This is a standard map reduce problem.
1. reduce the file by word: sending words into machines based on it's val.
2. count words, return top 10 words in each machine.
3. aggregate results together to get top 10.
-weiq
On Wed, Feb 2, 2011 at 8:46 AM, bittu wrote:
> @sankalp ...You seems to be r
@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(n>0)
{
sb.append((char)(('A' - 1) + (n-1)%26 + 1));
n = (n-1)/26;
}
return sb
-1;
//otherwise continue to go, until back to start
for(int i=0; i 0){
leftGas = left;
}else {
return -1;
}
}
return start;
}
On Sun, Jan 30, 2011 at 9:55 AM, Wei.QI wrote:
> For any gas pump, when your car arrives, it contains 0 or more gas.
> So, for each gas pump, the worst case is star
.
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 wrote:
> @Wei.Qi Can you clarify when your algorithm terminates and also what
> is the running time of the algorithm ?
>
>
>
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 pump
current = currentnext; // +1; should not move forward
here,
> }
> }
On Sat, Jan 15, 2011 at 1:55 PM, Jammy wrote:
> @Wei Please test you code on "cdbbcbbca". I believe it outputs 2
> instead of 8.
>
> On Jan 14, 4:09 am, "Wei.Q
@juver++, can you give me a test case that will time out?
On Fri, Jan 14, 2011 at 6:44 AM, juver++ 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 group, send ema
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]
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 wrote:
> An unbalanced dice (with 6 faces, numbered from 1 to 6) is thrown. The
> p
11 matches
Mail list logo