Bridgewater Associates interview question

write an algorithm for the game battleship