Pergunta de entrevista da empresa Walmart

Complete two React code in hackerrank, they are not difficult (eventlistener) but will consume time.