Pergunta de entrevista da empresa IBM

two LC easy/medium-difficulty questions for hackerrank