Short and Simple Code || O(N) Space and O(1) Space Solution
\nclass Solution {\npublic:\n    bool backspaceCompare(string s, string t) {\n        string x = "", y = "";\n        int n = s.size(), m = t.size();\n\n       
```\nclass Solution {\npublic:\n    bool backspaceCompare(string s, string t) {\n        string x = "", y = "";\n        int n = s.size(), m = t.size();\n\n        for (int i = 0; i < n; i++)\n            if (s[i] != \'#\') x += s[i];\n            else if (!x.empty()) x.pop_back();\n\n        for (int i = 0; i < m; i++)\n            if (t[i] != \'#\') y += t[i];\n            else if (!y.empty()) y.pop_back();\n\n        return (x == y);\n    }\n};\n\n// Time Complexity: O(N)\n// Space Complexity: O(N)\n\n-------------------------------------------------------------------------- -\nclass Solution {\npublic:\n    bool backspaceCompare(string s, string t)\n    {\n        int i = s.size() - 1, j = t.size() - 1, cnts = 0, cntt = 0;\n        while (i >= 0 || j >= 0)\n        {\n            char s_ch = \'#\';\n            while (i >= 0) {\n                if (s[i] == \'#\') {cnts++; i--; continue;}\n                if (cnts == 0 && s[i] != \'#\') {s_ch = s[i]; i--; break;}\n                cnts--;\n                i--;\n            }\n            char t_ch = \'#\';\n            while (j >= 0) {\n                if (t[j] == \'#\') {cntt++; j--; continue;}\n                if (cntt == 0 && t[j] != \'#\') {t_ch = t[j]; j--; break;}\n                cntt--;\n                j--;\n            }\n            if (s_ch != t_ch)   return false;\n        }\n        return true;\n    }\n};\n\n// Time Complexity: O(N)\n// Space Complexity: O(1)\n```
['String', 'Stack', 'C', 'C++']