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: https://discuss.codechef.com/questions/106401/help-me-solve-this-hackerrank-problem

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