DXC Technology interview question

Introduction, then one coding question(medium-hard)