Solve two algorithm problems from a menu | Palantir Coding Question