Re: [algogeeks] substring in big string

2012-10-18 Thread wujin chen
the size of the substring is an important factor~~ if the substring is only a character, it is easy. if the substring is 2 characters than the big string , it is easy too~~ am i right? :-) 2012/10/18 Ashish Goel ashg...@gmail.com there is a big string which needs 2GB memory to fit in but you

Re: [algogeeks] what will be the focus of yahoo in written exam ,what to study for it. please respond ASAP..

2011-11-14 Thread wujin chen
two month ago , I passed yahoo written test in china. data structure, algorithm , and given a code segment with some lines missing, ask you to fill it. today i rejected yahoo offically. actually i love to be one of yahoo. finally i chose microstrategy in hangzhou ,china, because it is close

[algogeeks] i cannot solve this written test question

2011-10-09 Thread wujin chen
Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than 1000. -- You received this message because you are subscribed to the

Re: [algogeeks] i cannot solve this written test question

2011-10-09 Thread wujin chen
@Ankur , as example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 I mean the sum of digits. 2011/10/9 Ankur Garg ankurga...@gmail.com Is it sum of bits or sum of digits ? On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.com wrote: Given a positive number N, find

Re: [algogeeks] i cannot solve this written test question

2011-10-09 Thread wujin chen
? On Sun, Oct 9, 2011 at 1:39 PM, wujin chen wujinchen...@gmail.comwrote: Given a positive number N, find a minimum number M greater than N, M has the same length with N and the sum of the bits are equal. example: N=134 , M=143, // 1+3+4=1+4+3 N=020, M = 101, //2=1+1 the length of N is less than

Re: [algogeeks] Re: i cannot solve this written test question

2011-10-09 Thread wujin chen
one cout\nDesired number is iendl; //may abort or continue to find more flag = true; } } if(!flag) cout\nNo such number foundendl; } On Oct 9, 5:04 pm, wujin chen wujinchen...@gmail.com wrote: @Aamir , yes, for some N, it will be no ans, then return -1. 2011/10/9 Aamir Khan ak4u2

[algogeeks] advice about yahoo needed!

2011-10-02 Thread wujin chen
hi all, i will graduate in 2012/5 as a master, and now i am hunting a job. last week, i got an oral offer from yahoo global RD center in beijing, ( http://beijing.yahoo.com/en/), the formal offer will arrive at the end of october. does anyone know something about it? i mean the develop

Re: [algogeeks] Re: c output,printf(%llx)

2011-09-19 Thread wujin chen
@Dave printf(a=%x, b=%llx,a,b,c); i think c will be ignored~~ , and the output is a=9,b=10 2011/9/19 Dave dave_and_da...@juno.com @Wujin: What do you expect the output to be? How does it differ from what you actually get? Dave On Sep 18, 8:47 am, wujin chen wujinchen...@gmail.com wrote

[algogeeks] c output,printf(%llx)

2011-09-18 Thread wujin chen
usigned long long x = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); the result is: a=9,b=123456780010 i wonder why~~ can anyone explain it? thanks. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this

Re: [algogeeks] c output,printf(%llx)

2011-09-18 Thread wujin chen
sorry , it should be : usigned long long c = 0x12345678; int a = 0x09; int b = 0x10; printf(a=%x, b=%llx,a,b,c); 2011/9/19 sagar pareek sagarpar...@gmail.com Check out what u have written... On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.comwrote: usigned long long x

[algogeeks] problems about the puzzle Chameleon

2011-09-05 Thread wujin chen
hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236): At one point, a remote island’s population of chameleons was divided as follows: - 13 red chameleons - 15 green chameleons - 17 blue chameleons Each time two different colored chameleons would meet, they would change their

Re: [algogeeks] Re: problems about the puzzle Chameleon

2011-09-05 Thread wujin chen
hi Don, i think f(15,14,16) =|15-14|+|14-16|+|16-15| = 1+2+1=4, hou do you get f(15,14,16) = 5? 2011/9/6 Don dondod...@gmail.com No, f(15,14,16) = 5. Don On Sep 5, 8:33 pm, wujin chen wujinchen...@gmail.com wrote: hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236

Re: [algogeeks] subarray wid sum=k

2011-09-02 Thread wujin chen
agree with hemank ! 2011/9/2 hemank lamba hemankla...@gmail.com Are you sure it is not continuous subsets. Because otherwise i guess it is a NP problem. On Fri, Sep 2, 2011 at 7:58 AM, manish kapur manishkapur.n...@gmail.comwrote: given an unsorted array of +ve and -ve elements.find a

Re: [algogeeks] maximum XOR

2011-08-27 Thread wujin chen
refer to this : http://discuss.joelonsoftware.com/default.asp?interview.11.614716 2011/8/27 jai gupta sayhelloto...@gmail.com @Neha take 42, 21 and 1 42 ^ 1 =43 while 42 ^21 =63 On Fri, Aug 26, 2011 at 10:28 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote: Sort the nos., which can be

Re: [algogeeks] array sum

2011-08-27 Thread wujin chen
take a subset from the array, if the average is equal then output the result. backtracing can do this. the time complexity seems not low, any good idea~~? 2011/8/27 sukhmeet singh sukhmeet2...@gmail.com how to divide an integer array into 2 sub-arrays and make their averages equal? array is

Re: [algogeeks] array question

2011-08-16 Thread wujin chen
i think XOR operator should be used to solve question. Given the integers in the array A: n1,n2...nk, we can do this recursively: XOR all the integers in A, assume the result is F = n1^n2^...^nk, F must not be 0. for i-th bit in F from rightmost to left most: if the i-th bit is 1, halve A

[algogeeks] how to estimate opponent's web page warehouse size?

2011-07-01 Thread wujin chen
you are an engineer of a search engineering company, such as google. every search engineering company has a web page warehouse which contains large numbers of web pages. and now you have a task, given two search engineerings, say google and yahoo, estimate yahoo's size of web page warehouse. you

Re: [algogeeks] MS interview question

2011-06-02 Thread wujin chen
how about this one? Node* reverseBy2(Node* head){ Node* p1 = head; if(p1 == NULL) return NULL; Node* p2 = p1-next; if(p2 == NULL) return head; Node* nextHead = p2-next; p2-next = p1; p1-next = reverseBy2(nextHead); return p2; } [?] 2011/6/1 Shivaji

Re: [algogeeks] Google Interview Question

2011-05-27 Thread wujin chen
@Piyush, how to deal with this case :100 , 10 2011/5/27 Piyush Sinha ecstasy.piy...@gmail.com we can work out if we sort according to the leftmost integer On 5/27/11, adityasir...@gmail.com adityasir...@gmail.com wrote: are you kidding me. Just simple sort wont work. On Fri, May 27,

[algogeeks] how to find a smallest prime bigger than a given number

2011-05-17 Thread wujin chen
given a number n, compute the smallest prime that is bigger than n. for example, n=8, then the smallest prime that bigger than 8 is 11. i wonder whether there is an effective way, rather than check every number bigger than n one by one. thanks. -- You received this message because you are

Re: [algogeeks] Re: how to find a smallest prime bigger than a given number

2011-05-17 Thread wujin chen
to check only numbers of the form 6*n - 1 and 6*n + 1. Dave On May 17, 9:09 pm, wujin chen wujinchen...@gmail.com wrote: given a number n, compute the smallest prime that is bigger than n. for example, n=8, then the smallest prime that bigger than 8 is 11. i wonder whether