Don’t Known why code is not working for hidden test cases
This test case will not pass your code.
5 3 1 6
Number of even values = 1
Number of odd values = 3
Though, the number of even values and number of odd values is different, it is still possible to find a permutation to fit the condition.
Your code is wrong. Even when number of odd numbers and even numbers is not equal then too odd sum of differences can be created. Only two cases form when numbers of odd numbers is zero or when number of even numbers is zero else it would always be possible to form odd sum of differences.