Pregunta de entrevista de Netskope

two algorithms to resolve, related to data structures