Nykaa interview question

Array/Stack based question on frequency on numbers