s
.s
and push the index of each digit onto its corresponding stack.t
and for each digit:
a. Check if the corresponding stack is empty. If it is, return false
because the digit is not present in s
.
b. Check if there are any smaller digits to the left of the current index that have not been moved. If there are, return false
.
c. Pop the index from the stack to simulate moving the digit.t
can be moved without any issues, return true
.