Pocket Gems Interview Question

2nd round phone: Reverse Backpack problem