Intuit Interview Question

Two questions in technical interview, which were easy to medium difficulty DSA question.