Pregunta de entrevista de IBM

The OA asked two leetcode medium questions