Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2375. Construct Smallest Number From DI String
Given a pattern of 'I' (increasing) and 'D' (decreasing) of length n, produce the lexicographically smallest string of distinct digits 1..9 of length n+1 whose adjacent comparisons match the pattern. Core challenge is to greedily assign the smallest unused digits while handling runs of consecutive 'D's (which force local reversals/stacking) so the overall sequence remains minimal.
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.