Petronas interview question

Coding Task to develop small functionality