Domanda di colloquio di Buzzvil

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