Infosys interview question

coding round tested problem-solving skills with a medium-difficulty algorithmic challenge