Bloomberg LP Interview Question
Financial Software Developersthis is a binary problem. sg has the right answer--you use powers of 2 (in this case, 1, 2, 4). if, for example, you had to divide 15 into as few segments as possible but still get all possible integers, you'd do 1, 2, 4, 8.
alternatively, if it was a ternary problem (for example, you want to weigh things using a scale, so the 3 options are 2 sides of the scale or not using a block) then you'd do powers of 3. so if you wanted to weigh all possible integer weights between 1 and 40, you'd do 1, 3, 9, 27.
1st - give 1
2nd day - yesterday's 1 + give 1 = 2
3rd day - 2 + 1 = 3
4th - 3 + 1 = 4
5th - 4 + 1 = 5
6th - 5 + 1 = 6
7th - 6 + 1 = 7
2 cuts........1 2 and 4
- sg December 15, 20091st day..giv 1
2nd day giv 2 n tek 1
3rd day giv 1
4th day giv 4 n tek 1 n 2..
carry n.