Minimum k to write each array element as a constrained sum

Company: Visa

Difficulty: medium