Re: [algogeeks] Re: Novell - Puzzle

2011-07-29 Thread Anders Ma
anders@anders-Satellite-U400:~/puzzle$ cat novel_she_calf.c #include stdio.h /* iIf a cow produces its first she-calf at age two years and after that produces another single she-calf every year, how many she-calves are there after 12 years? assuming none die. */ unsigned int she_calves(unsigned

Re: [algogeeks] Reverse

2011-06-30 Thread Anders Ma
On Tue, Jun 28, 2011 at 3:04 PM, sagar pareek sagarpar...@gmail.com wrote: I have 1 more solution :- #includestdio.h #includestring.h main() {  int i,j,l;  char arr[100];  printf(Enter the string\n);  fgets(arr,100,stdin);  for(i=0,l=strlen(arr),j=l;i=l/2;i++)  {   arr[j--]=arr[i];

Re: [algogeeks] Mouse Beer Puzzle

2011-06-28 Thread Anders Ma
I think the answer is 5. To know which one is poisonous, you have to use one mouse. How to use 3 mice achieve this goal? If all the 3 mice drink the poisonous beer, they will die first, how does the test go on? although you can let one mouse drink several beer in different time table, but if the

Re: [algogeeks] Re: PUZZLE

2011-05-21 Thread Anders Ma
1) go to 1000/3 with 1000 babanas, reserves 1000/3 at 1000/3 position 2) same as 1) now there are 2000/3 bananas at 1000/3 position. 3) go to 1000/3 position with 1000 babanas, then there are (2000/3 + 1000 - 1000/3) = 4000/3 babanas 4) go to (1000/3 + (4000/3 -1000)/3) = 4000/9 position with

Re: [algogeeks] [brain teaser ] W Riddle 16 may

2011-05-16 Thread Anders Ma
I‘v no idea, please give detail analysis, thanks! On Mon, May 16, 2011 at 5:26 PM, Piyush Sinha ecstasy.piy...@gmail.com wrote: @vivek...how come only one?? I think its 8... On Mon, May 16, 2011 at 1:03 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: W Riddle George Washington's wife was

Re: [algogeeks] Re: GOOGLE INTERVIEW QUESTION

2011-05-10 Thread Anders Ma
take “aabab” for example, the result is aba, b,a; however, the right result is aa,bab On Wed, May 11, 2011 at 10:57 AM, shubham shubh2...@gmail.com wrote: check this one out: #includeiostream #includecstdio #includevector #includecstring using namespace std; int check_palin(string

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread Anders Ma
sometimes we need goto, goto is not so evil. On Tue, May 10, 2011 at 2:49 AM, Manjeet Chayel chayel.manj...@gmail.com wrote: Dont use goto... its not good to have it. On Mon, May 9, 2011 at 2:44 PM, Anders Ma xuejiao...@gmail.com wrote: #include stdio.h #include string.h int

Re: [algogeeks] GOOGLE INTERVIEW QUESTION

2011-05-09 Thread Anders Ma
, 2011 at 10:11 AM, oldman fenghaungyuyi...@gmail.com wrote: I agree with Anders Ma's point,but in my opinion, using goto is risky in a import interview On Tue, May 10, 2011 at 9:52 AM, Anders Ma xuejiao...@gmail.com wrote:  sometimes we need goto, goto is not so evil. On Tue, May 10, 2011 at 2

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-22 Thread Anders Ma
when they are getting only one coins each? On Thu, Apr 21, 2011 at 3:05 PM, harshit agrawal hagrawal.250...@gmail.com wrote: thwy will be shared according to senior most pirate(5th)=98 4th =0 3rd =1 2nd=0 1st =1 On Thu, Apr 21, 2011 at 2:54 PM, Anders Ma xuejiao...@gmail.com wrote

Re: [algogeeks] [brain teaser ] Hardest Brain Teaser 22april

2011-04-22 Thread Anders Ma
I googled and got the answer, if not, I can not find out even 1000 years. On Fri, Apr 22, 2011 at 3:58 PM, Anurag atri anu.anurag@gmail.com wrote: hehe :) here is a hint : dots and dashes :) On Fri, Apr 22, 2011 at 12:53 PM, Shuaib aries.shu...@gmail.com wrote: Well, I know the answer,

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Anders Ma
the coins will be shared the way the oldest pirate proposes. On Thu, Apr 21, 2011 at 3:51 PM, Lavesh Rawat lavesh.ra...@gmail.com wrote: Pirate Puzzle 5 pirates of different ages have a treasure of 100 gold coins. On their ship, they decide to split the coins using this scheme: The oldest

Re: [algogeeks]

2011-04-21 Thread Anders Ma
the segment which stores hello may be read only, so writing to it may cause unexpected result. On Thu, Apr 21, 2011 at 6:45 PM, rahul rahulr...@gmail.com wrote: will crash... :) On Thu, Apr 21, 2011 at 4:14 PM, riti gupta ritigupt...@gmail.com wrote: is there any error in following code?

Re: [algogeeks] [brain teaser] Pirate Puzzle 21april

2011-04-21 Thread Anders Ma
they are getting only one coins each? On Thu, Apr 21, 2011 at 3:05 PM, harshit agrawal hagrawal.250...@gmail.com wrote: thwy will be shared according to senior most pirate(5th)=98 4th =0 3rd =1 2nd=0 1st =1 On Thu, Apr 21, 2011 at 2:54 PM, Anders Ma xuejiao...@gmail.com wrote: the coins

Re: [algogeeks] Basic Algorithms!!

2011-04-19 Thread Anders Ma
Introduction to algorithms http://www.amazon.com/Introduction-Algorithms-Third-Thomas-Cormen/dp/0262033844 On Tue, Apr 19, 2011 at 5:06 PM, Vishnutej mylavarapu.vishnu...@gmail.com wrote: Hello everyone, Wat according to u are the basic algorithms that a programmer should know for sure? If