Goldman Sachs Interview Report
- 0of 0 votes
AnswersPrint 'n' elements of fibonacci series.
- PCB March 05, 2013 in Indiapublic int fibonacci(int n) { if ((n == 1) || (n==2)) { System.out.print("\t" + 1); return 1; } int temp = fibonacci (n-1) + fibonacci (n-2); System.out.println("\t" + temp); return temp;
| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm - 0of 0 votes
AnswersPuzzle : There will be two sticks, if you burn each sticks from one side both will burn for an hour. You don't have any watch or stop watch, How you will measure 1 n half our and 45 min?
- PCB March 05, 2013 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer - 1of 1 vote
AnswersFind wether there is a loop in a given liked list or no?
- PCB March 05, 2013 in India
I solved it using two pointers. But they were not satisfied as I knew this solution before. They wanted me to solve using Single pointer.| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm - 0of 0 votes
AnswersAccording to the story, four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed.
- PCB March 05, 2013 in India
The jailer puts three of the men sitting in a line. The fourth man is put behind a screen (or in a separate room). He gives all four men party hats (as in diagram). The jailer explains that there are two red and two blue hats; that each prisoner is wearing one of the hats; and that each of the prisoners is only to see the hats in front of them but not on themselves or behind. The fourth man behind the screen can't see or be seen by any other prisoner. No communication between the prisoners is allowed.
If any prisoner can figure out and say to the jailer what colour hat he has on his head all four prisoners go free. If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the prisoners can escape, regardless of how the jailer distributes the hats?| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm