Nielsen Interview Question

Machine coding question for React