battleship and median problems from codeacademy