Ocient interview question

Leetcode style questions, first question using arraylist and second question developed further with hashset.