ABC interview question

data structures and algo complexities