Gold bar puzzle

You have some work to be done by a worker in 7 days. The worker need to be paid every day after his work. The total cost of the work of 7 days is one gold bar (so every day the worker must be paid 1/7’th of the bar). You have only one gold bar, and […]

Points on globe – Interview puzzle

How many points are there on the globe, so that if you walk 1km south, then 1km east and then 1km north, you reach the place where you started.

Fastest horse Interview question

There are twenty five horses and you can conduct a race of only five horses at one time. There is no way to find out the absolute speed of a horse (we only know there relative speed). At least how many races will it take to determine the three fastest horses?

Check if two arrays are permutation of each other

Given two arrays of integers, write a code to check if one is permutation (arranging the same numbers differently) of elements present in the other. For example, the below two arrays are permutations of each other: int a[5] = {1, 2, 3, 4, 5}; int b[5] = {2, 1, 4, 5, 3};

Count all left nodes in a Binary tree

One way to ask this question is: Given a Binary tree that represent a family hierarchy. A parent can have at most two children (at most one girl child and at most one boy child). A girl child (if present) is always represented as left child in the binary tree, and a boy child (if present) […]

5 Pirates Puzzle dividing 1000 coins

There are 5 pirates, A, B, C, D and E. They have a strict hierarchy, A is senior to B, B is senior to C, C is senior to D and D is senior to E. So it is like (A > B > C > D > E). These pirates have 1000 gold coins […]

Storing Binary Tree in a file

Given a Binary tree, write two function. The first function should write the binary tree in a file and second function should read the file and should be able to construct the same binary tree. Here writing to file is not important, the important thing is to preserve the state of the Binary tree. Think […]