💥💥Beats 100% on runtime and memory [EXPLAINED]
Intuition\nThe goal is to determine if we can transform string s into string t by sorting substrings. Since sorting a substring can rearrange elements, we need 
# Intuition\nThe goal is to determine if we can transform string s into string t by sorting substrings. Since sorting a substring can rearrange elements, we need to ensure that the order of digits in t can be matched by the indices of those digits in s without violating the rules of sorting.\n\n# Approach\nTrack the positions of each digit in s, then for each digit in t, check if the digit can be placed by ensuring that no smaller digit appears later in s than the current digit in t.\n\n# Complexity\n- Time complexity:\nO(n), where n is the length of the strings, because we go through each character in s and t once.\n\n\n- Space complexity:\nO(1), since we only use a fixed-size array to store indices for digits (0-9), regardless of the input size.\n\n\n# Code\n```typescript []\n/**\n * Checks if string `s` can be transformed into string `t` by sorting substrings.\n * @param {string} s - The original string.\n * @param {string} t - The target string to transform into.\n * @param {number} n - The length of the strings (defaults to length of s).\n * @return {boolean} - Returns true if transformation is possible, otherwise false.\n */\nfunction isTransformable(s: string, t: string, n: number = s.length): boolean {\n    // Create an array to hold the indices of each digit (0-9)\n    const indices: number[][] = Array.from({ length: 10 }, () => []);\n\n    // Populate indices with the positions of each digit in string s\n    for (let i = n - 1; i >= 0; i--) {\n        indices[Number(s[i])].push(i);\n    }\n\n    // Iterate through each character in string t\n    for (let i = 0; i < n; i++) {\n        const num = Number(t[i]);\n\n        // If there are no indices for the current digit in t, transformation is impossible\n        if (!indices[num].length) {\n            return false;\n        }\n\n        // Pop the last index of the current digit\n        const index = indices[num].pop()!;\n\n        // Check if there are any digits less than the current digit that appear after it\n        for (let j = 0; j < num; j++) {\n            // If any smaller digit has an index that appears after the current index, return false\n            if (indices[j].length && indices[j][indices[j].length - 1] < index) {\n                return false;\n            }\n        }\n    }\n\n    // If all checks passed, transformation is possible\n    return true;\n}\n\n\n\n```
['TypeScript']