Sphinx Solution interview question

mix of javascript and react js and problem solving