[Java] Bubble sort with LinkedList and compression
\nclass Solution {\n    public boolean isTransformable(String s, String t) {\n        LinkedList<Pair> compressed = new LinkedList<>();\n        for (int i = 0;
```\nclass Solution {\n    public boolean isTransformable(String s, String t) {\n        LinkedList<Pair> compressed = new LinkedList<>();\n        for (int i = 0; i < s.length(); i++) {\n            if (compressed.isEmpty() || compressed.getLast().getKey() != s.charAt(i) - \'0\') {\n                compressed.addLast(new Pair(s.charAt(i) - \'0\', 1));\n            } else {\n                int prev = compressed.getLast().getValue();\n                compressed.removeLast();\n                compressed.addLast(new Pair(s.charAt(i) - \'0\', prev + 1));\n            }\n        }\n        \n        flag: for (int i = 0; i < t.length(); i++) {\n            int cur = t.charAt(i) - \'0\';\n            var iterator = compressed.iterator();\n            \n            while (iterator.hasNext()) {\n                Pair pair = iterator.next();\n                if (pair.getKey() < cur) {\n                    return false;\n                }\n                \n                if (pair.getKey() == cur) {\n                    if (pair.getValue() == 1) {\n                        iterator.remove();\n                    } else {\n                        pair.setValue(pair.getValue() - 1);\n                    }\n                    \n                    continue flag;\n                }\n            }\n            \n            return false;\n        }\n        \n        return true;\n    }\n    \n    private static class Pair {\n    \tprivate int key;\n    \tprivate int value;\n    \t\n    \tpublic Pair(int key, int value) {\n    \t\tthis.key = key;\n    \t\tthis.value = value;\n    \t}\n    \t\n    \tpublic int getKey() {\n    \t\treturn key;\n    \t}\n    \t\n    \tpublic int getValue() {\n    \t\treturn value;\n    \t}\n    \t\n    \tpublic void setValue(int value) {\n    \t\tthis.value = value;\n    \t}\n    }\n}\n```
[]