Make them distinct

question:https://hack.codingblocks.com/practice/p/380/852
answer:https://ide.codingblocks.com/s/62874
using bruteforce two testcases are passed but i cannot identify logic for a optimized solution

Hi AASTHA, for optimized solution you just need to think of that case wherein your ans becomes NO. Have a look at these arrays:

// Array 1
7
1 2 1 2 1 2 1
// Array 2
6
1 2 1 2 1 2

Hope this helps :slight_smile: