Palindrome lover
Practice
3.6 (11 votes)
Bitmask
Basics of bit manipulation
Basic programming
Bit manipulation
Bit manipulation
Basics of bit manipulation
Problem
71% Success 3174 Attempts 20 Points 2s Time Limit 256MB Memory 1024 KB Max Code

Given an array of \(N\) integers

You have to transform the array, for every \(i (1 \leq i \leq N)\): \(a[i] = a[i] \%2\)

For example: if the given array is 3,4,5 then after the transformation the array will be 1,0,1


Your task is to convert the array into a palindrome and for that you can re-arrange the elements however you wish

Is it possible to convert the array into a palindrome?


Input :
The first line contains \(T\), the number of test cases \(1 \leq T \leq 10^3\)
The second line contains \(N\), the number of array elements \(1 \leq N \leq 10^5\)
The third line contains \(N\) integers, the array elements \(1 \leq a[i] \leq 10^9\)


Output:
For all test cases print \(1\) if the array can be converted into a palindrome or else print \(0\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
11 votes
Tags:
Bit ManipulationBasic ProgrammingBasics of Bit ManipulationC++
Points:20
12 votes
Tags:
Bit ManipulationBasic ProgrammingBasics of Bit Manipulation
Points:20
2 votes
Tags:
Bit ManipulationBasics of Bit ManipulationBasic Programming