FPT Software interview question

A medium coding question use DSA