Neubus interview question

two leet code questions 1 hour time.