in the above problem consider the below test case:
t=1
n=2
7 3
o/p should “NO” because both can’t kill enemies at rhe same time…
but in the successful submission it is “YES”
in the above problem consider the below test case:
t=1
n=2
7 3
o/p should “NO” because both can’t kill enemies at rhe same time…
but in the successful submission it is “YES”
your solution is successful??
Yes, as it shows…
It is a simple problem, that outputs “YES” if the total strength can be divided into two parts, otherwise “NO”
In
7 3 the output should be YES
in case of 7 3 sinchan and ace can’t kill enemies at same time
because one take 7 and other take 3…so o/p should “NO”.
I also encountered the same problem in this set : 2 4 5 7 10 12 .
Used this input on a successful submission.
They can’t kill the terrorists at the same time in whatever way they try. But, the output shows yes.
Any explanation for such situations ?
yes…the same problem occurs with me…
I am the author for that question. I am extremely sorry for weak test cases. The question can be broken down to Can an Array be partitioned into two non-empty equal sub-arrays. For implementation you can visit here http://www.geeksforgeeks.org/dynamic-programming-set-18-partition-problem/