Given an array whether it is possible to obtain an array having distinct neighboring elements by swapping two neighboring array elements.
First line consists of T test cases. First line of every test case consists of an integer N, denoting number of elements in array. Second line of every test case consists of elements of array.
Single line output, print YES if possible else NO.
7 7 7 7
1 1 2
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.