Search
⌘K
Get Premium
Leetcode 1663. Smallest String With A Given Numeric Value
Given n and k, construct the lexicographically smallest lowercase string of length n whose characters' 1..26 numeric values sum to k (feasible since n ≤ k ≤ 26·n). The core challenge is to distribute the required extra value above the n minimal 'a's across positions so the resulting string is dictionary-minimal, typically by allocating increases as far to the right as possible.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.