Question d’entretien chez Buzzvil

general data structure question and explain the thought process (+ what is the time complexity for your solution)