Pregunta de entrevista de Citadel Securities

Two leetcode medium questions, pretty standard