Marks :100
: 2 | : 0
Antonio got an array for his Christmas present. the array he got consists of N positive integers.
He was getting bored on Christmas eve and decided to solve the below problem to overcome his boredom:
What's the minimum length subset of the given array such that the sum of all elements of this subset is an odd number?
Antonio got stuck in the problem and has a party to attend at night. hence you being Antonio's best friend decided to help him solve the problem.
Given array A print the maximum possible length of a subset of this array such that the sum of all elements of this is an odd number. If there is no subset present print -1
A subset of array A as a tuple can be obtained from A by removing some (possibly all elements of it)
First line contain a single integer N .($$$1 \le N \le 10^5$$$)
The next line contains N space-separated integers denoting the elements of array A.($$$1 \le a[i] \le 10^9$$$)
Print the maximum possible length of print -1 if no subset is present.
4 4 2 3 1
3
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.