[C] Easy to understand, O(1) space, O(n+m) time, one pass. Runtime 0ms
Traverse both the strings from the end until we encounter an undeleted character in each. Compare them and return false if not the same. Continue doing the same
Traverse both the strings from the end until we encounter an undeleted character in each. Compare them and return false if not the same. Continue doing the same until all characters in both strings are checked.\n\n**Complexity**\nTime: O(n+m)\nSpace: O(1)\n\n```\nbool backspaceCompare(char * S, char * T){\n    int si = strlen(S)-1, ti = strlen(T)-1;\n    //backspace counts for each string\n    int sb = 0, tb = 0;\n    \n    while (si >= 0 || ti >= 0) {\n        if (si >= 0 && S[si] == \'#\') {        // increment S backspace count\n            si--, sb++;\n        } else if (sb) {                      // S backspace is pending\n            si--, sb--;\n        } else if (ti >= 0 && T[ti] == \'#\') { // increment T backspace count\n            ti--, tb++;\n        } else if (tb) {                      // T backsapce is pending\n            ti--, tb--;\n        } else if (si < 0 || ti < 0 || S[si] != T[ti]) {\n            return false;\n        } else {\n            si--, ti--;\n        }\n    }\n    \n    return true;\n}\n```
[]