This is a verified interview question from Amazon. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Minimum Operations to Sort String" covers key patterns like Strings.
"Developers at Amazon are testing a modified algorithm for sorting strings. Given a string strValue, find the minimum number of operations required to sort the string. Operation: Choose any proper substring of strValue and sort it. A proper substring of the string S is any substring of S except S itself. For example, if S = "adabc", then "adab" is a proper substring of S, while "adabc" is not. A string S is a substring of a string T if S can be obtained from T by deletion of several (possibly, zero or all) characters from the beginning and from the end."
Join thousands of developers practicing for Amazon.