LC: 484. Find Permutation - spiralgo/algorithms GitHub Wiki
The Essence:
For the most basic input, it can be a string consisting of 'I's.
When the given string is "IIIIIIII" (8 'I's), a strictly increasing array should be the output: [1,2,3,4,5,6,7,8,9]
When we place 3 'D's into it: "IIIIDDDI" => [1,2,3,4,8,7,6,5,9]:
It can be seen that 'D' simply invert the previous ascending subarray of the original sequence.
Details:
The problem solver can used while loops for finding how many 'D' is are present in some substring. After that, the original ascending sequence can be reversed from the start to the end of the subarray.