Chili Piper Interview Question

HackerRank algorithm and React app problem