Is partitioning an array into halves with equal sums P or NP?
问题 This was an algorithm interview question about the Partition Problem. You are given an array which consists of numbers with between 0 and 5 digits. Write a function which will return whether the array can be divided into 2 halves such a that sum of the two halves would be equal. Is this an NP problem or can it be solved by dynamic programming? "between 0 and 5 digit" means 0 ~ 99999, I think. I found a good answer to this outside SO here. 回答1: Both. The problem is in NP, and I'm pretty sure