two pointer approach easy solution in java
\n# Approach\nTwo pointer\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n\nclass Solution {\n    public boolean backspaceComp
\n# Approach\nTwo pointer\n\n# Complexity\n- Time complexity:\nO(n)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\n    public boolean backspaceCompare(String s, String t) {\n        String s1 = updatedString(s);\n        String t1 = updatedString(t);\n        System.out.println(s1+ t1);\n        return s1.equals(t1);\n    }\n    private String updatedString(String s){\n        StringBuilder result = new StringBuilder();\n        int c=0;\n         for(int i=s.length()-1;i>=0;i--){\n            if(s.charAt(i)==\'#\')\n            {\n                c++;\n            }\n            else{\n                if(c>0)\n                c--;\n                else\n                result.append(s.charAt(i));\n            }\n        }\n        return result.reverse().toString();\n    }\n}\n```
['Java']