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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…