Amazon Interview Question

dsa question from array manipulation and set operation