Available question text
Compute how many distinct permutations of the multiset of characters in s are lexicographically smaller than s (equivalently the number of previous-permutation steps to reach the sorted string), returning the count modulo 10^9+7. The core challenge is efficient combinatorial counting of permutations with duplicates (multinomial coefficients/factorials with modular inverses) for n up to 3000.
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 1830. Minimum Number of Operations to Make String Sorted
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source