Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Leetcode 2663. Lexicographically Smallest Beautiful String
Given a beautiful string s over the first k lowercase letters, find the lexicographically smallest string of the same length that is strictly greater than s and contains no palindromic substring of length ≥2 (i.e., forbids equal adjacent letters and patterns like a_b_a). This is essentially the "next lexicographic string under local no-palindrome constraints" problem, solvable by greedy increment with backtracking.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early December, 2024
Amazon
Mid-level
Generate a special string of length n that is lexicographically greater than a given string s, where a special string has no matching adjacent characters
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.