Where is the code wrong…
Q Given an array is it possible to divide array in two parts with equal sum?
give some test cases where the code breaks.
Thanks in advance.
Where is the code wrong…
Q Given an array is it possible to divide array in two parts with equal sum?
give some test cases where the code breaks.
Thanks in advance.
Your code gives output NO for:
6
5 6 7 7 19 20
But, 20+5+7=19+6+7.
Google “balanced partition problem” for help.
Are we supposed to divide them into two consecutive sub arrays??
Also post link to the problem statement.