0484. Find Permutation
https://leetcode.com/problems/find-permutation
Description
A permutation perm
of n
integers of all the integers in the range [1, n]
can be represented as a string s
of length n - 1
where:
s[i] == 'I'
ifperm[i] < perm[i + 1]
, ands[i] == 'D'
ifperm[i] > perm[i + 1]
.
Given a string s
, reconstruct the lexicographically smallest permutation perm
and return it.
Example 1:
Example 2:
Constraints:
1 <= s.length <= 105
s[i]
is either'I'
or'D'
.
ac
Last updated