Solution Check If String Is Transformable With Substring Sort Operations
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public function isTransformable($s, $t) {\n        $n = strlen($s);\n        $pos = array_fill(0, 10, $n);\n        \n        for ($i = 0; $i < $n; $i++) {\n            if ($pos[ord($s[$i]) - ord(\'0\')] == $n) {\n                $pos[ord($s[$i]) - ord(\'0\')] = $i;\n            }\n        }\n        \n        for ($i = 0; $i < $n; $i++) {\n            $num = ord($t[$i]) - ord(\'0\');\n            if ($pos[$num] == $n) {\n                return false;\n            }\n            for ($j = 0; $j < $num; $j++) {\n                if ($pos[$j] < $pos[$num]) {\n                    return false;\n                }\n            }\n            $pos[$num]++;\n            while ($pos[$num] < $n && ord($s[$pos[$num]]) - ord(\'0\') != $num) {\n                $pos[$num]++;\n            }\n        }\n        \n        return true;\n    }\n}\n\n```
['PHP']