Last Stone Weight II
Medium
2D DP & Knapsack Variants
Stones have the given weights. In each move two stones of weights x <= y are smashed together: if x == y both are destroyed, otherwise a stone of weight y - x remains. Print the smallest possible weight of the final stone (0 if none remains).
Constraints
1 <= n <= 30 1 <= weight <= 100
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.