You are given a string s consisting of lowercase English letters.
In one operation, you can choose any proper substring of s (a contiguous substring of length strictly less than the length of s) and sort its characters in ascending order.
Return the minimum number of operations needed to sort the entire string s in ascending order. If it is impossible to sort the string, return
Constraints:
s.length
s consists of only lowercase English letters.
You are given a string s consisting of lowercase English letters.
In one operation, you can choose any proper substring of s (a contiguous substring of length strictly less than the length of s) and sort its characters in ascending order.
Return the minimum number of operations needed to sort the entire string s in ascending order. If it is impossible to sort the string, return
Constraints:
s.length
s consists of only lowercase English letters.