Pergunta de entrevista da empresa IDFC FIRST Bank

They asked me to solve a DSA problem and explain my approach