Hexagon interview question

Few puzzles and algorithm and logic for some codes