Available question text
Given a string s of 'I' and 'D' of length n, construct any permutation of [0..n] such that perm[i] < perm[i+1] when s[i]=='I' and perm[i] > perm[i+1] when s[i]=='D'. This is solved greedily by assigning the smallest or largest remaining numbers to satisfy each local inequality.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 942. DI String Match
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source