Problem 3752 · Medium

Lexicographically Smallest Negated Permutation that Sums to Target

Fix positions left to right, trying the smallest signed value first and keeping it only when the remaining values can still reach the target.

Open the interactive visualisation