Practice Lexicographically Smallest String After Operations With Constraint
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given a lowercase string s and an integer k, return the lexicographically smallest string t of the same length whose distance from s is at most k. The distance is the sum of the distances between corresponding letters. For two letters, use the shorter distance around the circular alphabet, where a and z are adjacent.
Source: Lexicographically Smallest String After Operations With Constraint on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "zbbz", k = 3
"aaaz"
# Example 2
s = "xaxcd", k = 4
"aawcd"
# Example 3
s = "lol", k = 0
"lol"
Constraints
Related LeetCode Problems
Practice more problems similar to Lexicographically Smallest String After Operations With Constraint.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.