Given $n(n>=1)$ integers $k_1,k_2 \cdots k_n(k_i>=0)$, and an integer $p>=1$, Johny picks $p^{k_i}$ from $i-th$ category for each category , and he wants to divide them into two disjoint sets, minimizing the absolute difference between sums of numbers in each set.
let's sort the k array in non decreasing order.
Suppose if $\sum_{i=1}^{n−1}p^{k_i}<p^{k_n}$ then we put $p^{k_n}$ in one set and the remaining powers in other set and compute the powers and their difference.
Now if $\sum_{i=1}^{n−1}p^{k_i}>=p^{k_n}$ ,How do I prove that there exists $j$ such that $\sum_{i=j}^{n−1}p^{k_i}=p^{k_n}$,so that we could put $p^{k_n}$ in one set and $\sum_{i=j}^{n−1}p^{k_i}$ in other set to make their absolute difference $0$ and go on to index $j−1$ and repeat the process?