Hexagon interview question

programming