Java Two Pointer With Explanation - beat 98%
\n/**\n    1. Thoughts\n        - from back to front\n        - if count > 0 && != #, skip\n        - if count == 0 && different, return false\n        - if #, 
```\n/**\n    1. Thoughts\n        - from back to front\n        - if count > 0 && != #, skip\n        - if count == 0 && different, return false\n        - if #, count++\n        - if one ends, the other count == 0 && has any char return false\n        - else return true\n*/\nclass Solution {\n    public boolean backspaceCompare(String S, String T) {\n        int i = S.length()-1;\n        int j = T.length()-1;\n        int countS = 0;\n        int countT = 0;\n        while (i >= 0 || j >= 0) {\n            while (i >= 0 && (countS > 0 || S.charAt(i) == \'#\')) {\n                if (S.charAt(i) == \'#\') countS++;\n                else countS--;\n                i--;\n            }\n            char left = i < 0 ? \'@\' : S.charAt(i);\n            while (j >= 0 && (countT > 0 || T.charAt(j) == \'#\')) {\n                if (T.charAt(j) == \'#\') countT++;\n                else countT--;\n                j--;\n            }\n            char right = j < 0 ? \'@\' : T.charAt(j);\n            if (left != right) return false;\n            i--;\n            j--;\n        }\n        return true;\n    }\n}\n```
[]