Hackerrank - Same Occcurence

What exactly we needed to do in this problem?

I read the editorial but could not understand the third case given there, which is when both x and y are present in the original array.

Question link

Kindly Help.
Thank You.

See this thread: Help me solve this hackerrank problem. - general - CodeChef Discuss

I wasnt able to understand any case in my time :frowning: