Infosys Interview Question

one of the coding question asked from the DSA concept