Java two pointer beats 100%
\nclass Solution {\n    public boolean backspaceCompare(String S, String T) {\n        int i = S.length() - 1;\n        int j = T.length() - 1;\n        int cou
```\nclass Solution {\n    public boolean backspaceCompare(String S, String T) {\n        int i = S.length() - 1;\n        int j = T.length() - 1;\n        int countInS = 0;\n        int countInT = 0;\n        \n        while(true){\n            // perform backSpace operation at S\n            while(i >= 0){\n                if(S.charAt(i) == \'#\'){\n                    countInS++;\n                    i--;\n                }\n                else if(countInS > 0){\n                    countInS--;\n                    i--;\n                }\n                else{\n                    break;\n                }\n            }\n            // perform backSpace operation at T\n            while(j >= 0){\n                if(T.charAt(j) == \'#\'){\n                    countInT++;\n                    j--;\n                }\n                else if(countInT > 0){\n                    countInT--;\n                    j--;\n                }\n                else{\n                    break;\n                }\n            }\n            if (i >= 0 && j >= 0){ // if there are characters in both S and T\n                if(S.charAt(i) == T.charAt(j)) {\n                    i--;\n                    j--;\n                } \n                else {\n                    return false;\n                }\n            }\n            else{ // if no character remaining in S or T or both\n                break;\n            }\n        }\n        return (i == j) ? true : false;\n    }\n}\n```
['Two Pointers', 'Java']