Pregunta de entrevista de Yandex

and some algorithm questions from leet code or Hacker rank