Today's studying involved "Dynamic Programming" and "Backtracking", which really turned out to be different names for little tricks I've used before in recursion. I'm going to have to look at them again, just to make sure I've got it straight, in case I get asked. I don't want to look like an idiot because I don't know something's name.
Especially if I use it all the time.
Anyway. I know why you're really here: today I tried a brainteaser from techinterview about pirates. It ARRRR-ta be a lot of fun.
Five pirates have captured a booty of 100 gold pieces. As you know, pirates use a seniority system when it comes to making decisions; in this case, the most senior pirate is pirate #5 and the least senior is pirate #1 (n00b).
You also know, of course, that pirates are greedy. And bloodthirsty. What sets this group of pirates apart, though, is how intelligent they are.
By which I mean that they're really smart (not noteworthy in the opposite direction).
Their method of dividing the 100 coins will be in keeping with pirate greed, violence, and seniority. The most senior pirate will propose a division of booty. All the pirates will vote to accept or reject the proposal. If at least 50% approve, the booty is divided according to the proposal. Otherwise, the propose-er walks the plank, and the new most senior pirate makes a new proposal.
Of course, having such massive brainpower, the most senior pirate makes a proposal that is automatically accepted. What was it?