Solve four algorithmic problems | Citadel Interview Question