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 3178 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\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
150 votes
Tags:
ReadyBrute-force searchEasy-MediumApprovedBreadth-first search
Points:20
10 votes
Tags:
ApprovedBasic ProgrammingBit manipulationEasyGrammar-VerifiedImplementationPriority queueReadyRecruit
Points:20
71 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationMath
Editorial