Beginner Friendly|with comments | easy | short | faster then 100% | O(N)
the keys idea is a try to bring a digit in s to correct position w.r.t  t by swpping it with either  left or right neighbour . Just to keep in mind we cant swap
`the keys idea is a try to bring a digit in s to correct position w.r.t  t by swpping it with either  left or right neighbour . Just to keep in mind we cant swap with left neigbour if this neighbour is smaller and we cant swap right neighbour if this neighbour is larger .`\n\n```\n code for the same:\n Runtime: 196 ms, faster than 100.00% \n```\n\n```\n\nclass Solution:\n    def isTransformable(self, s: str, t: str) -> bool:\n        if s==t:\n            return True\n        elif len(s)!=len(t):\n            return False\n\t\t# to check if both strings has same digits with same frequency\n        if collections.Counter(s)!=collections.Counter(t):\n            return False\n        char2index=collections.defaultdict(collections.deque)\n        for i,char in enumerate(s):\n            char2index[char].append(i)\n\t\t#char2index store each digit as key and it values in a deque sotring index of its location in string s\n        for i,char in enumerate(t):\n\t\t\t\n            index=char2index[char].popleft()  # to get locations of char in s\n\t\t\t# this loop check whether or not we can bring char from location index in s to location i\n\t\t\t# for this we go checking ,if there exist any digits in char2number smaller then char and\n\t\t\t# whose location is less then index\n            for num in range(int(char)):\n                if char2index[str(num)] and char2index[str(num)][0]<index:\n                    return False\n        return True\n```
[]