Halodoc interview question

Finding frequency and performing some operations on an array