NeetCode #504LC-2375MediumBacktracking
← Back to All Problems

#504 · #2375 · Construct Smallest Number From DI String(根据模式串构造最小数字)

📌 Problem Statement & Constraints

You are given a string pattern of 'I' (increase) and 'D' (decrease). Return the lexicographically smallest permutation of 1..n+1 that matches the pattern. Constraints: 1 <= pattern.length <= 8.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!