Neubus Interview Question

two leet code questions 1 hour time.