Pergunta de entrevista da empresa LTM Limited

Coding based question of swapping