FDM Group interview question

Logic questions and pseudo code