Google interview question

Design pattern, complexity, Ds, alogrithm