Scene 1 of Heuristics in Core Technical Interview Questions for Software Engineers
By Amin Ariana — January 2014
Problem Statement
Someone hires you to do equal days of work for them for seven days in a row. You don't necessarily trust this guy to owe you wages, so you want to be paid for the work you did everyday. He happens to have a gold bar with seven equal segments on it, each worth a day of your wages. He offers to break off one segment and give it to you each day. But you know that smaller pieces of gold are less likely to appreciate in value over time. What should you tell him to do?
No, he doesn't have cash. No you can't trust him to give the whole bar to you in the end.
Evaluation
Did you manage to get paid without breaking down the gold bar more than twice? (100%)
Solution
Note that if you use any hints, you lose the grade. So don't look. But if you have to, here they are:
Hint 1
Seven is a very nice number in binary.
Hint 2
Can you solve it by breaking the bar only twice?
Hint 3
7 = 4 + 2 + 1
References
Microsoft recruiters used to ask this from Product Managers and Software Engineers in early stages of the screening