Chili Piper interview question

HackerRank algorithm and React app problem