Liquidminds interview question

Dsa and algorithm pseudo code