Python simple solution beats 100% || Two Pointer || Explained
1. Brute force solution\n# Intuition\n Describe your first thoughts on how to solve this problem. \n- Converting two strings into final form and compare them.\n
# 1. Brute force solution\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- Converting two strings into final form and compare them.\n# Code\n```\nclass Solution(object):\n    def backspaceCompare(self, s, t):\n        def convert_string(string): # the function that convert string to the final form\n            build_Array = [] # Storing the final form of string in an array\n            for i in string:\n                if i != "#":\n                    build_Array.append(i)\n                else:\n                    try:\n                        build_Array.pop()\n                    except:\n                        pass\n            return build_Array\n        finalS = convert_string(s)\n        finalT = convert_string(t)\n        #compare the length between FinalS and FinalT\n        if len(finalS) != len(finalT):\n             #If they do not equal\n            return False  \n        else:\n            for p in range(len(finalS)): #Go through each word in both final strings\n                if finalS[p] != finalT[p]:\n                    # If they exist one word that do not match\n                    return False\n        return True # when went through both final strings and did see any word that do not match\n\n```\n# Complexity\n- Time complexity: O(a+b)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(a+b)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n# 2. Optimal solution using Two Pointers\n# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n- There is maybe a way to remove an array data structure and find some other way to figure out both strings match or not because The question just requires True or falase.\n# Approach\n1. Using two pointers P1 and P2 to go through each word in both strings from the end\n2. If one of those pointers equal \'#\' then step that pointer 2 index (when step it, it still contain \'#\' then continue skip 2 index) else compare those pointer together if they not match the value then know that both strings do not equal\n# code\n```\nclass Solution(object):\n    \n    def backspaceCompare(self, s, t):\n         p1 = len(s)-1   \n         p2 = len(t)-1   \n         while p1 >=0 or p2 >= 0:\n             if (p1 >= 0 and s[p1] == \'#\') or (p2 >= 0 and t[p2] ==\'#\'):\n                 if s[p1] ==\'#\':\n                     backcount = 2\n                     while backcount > 0:\n                         p1 -=1   \n                         backcount -= 1   \n                         if p1 >=0 and s[p1] == \'#\':\n                             backcount += 2\n                 if t[p2] ==\'#\':\n                     backcount = 2 \n                     while backcount > 0:\n                         p2 -=1\n                         backcount -= 1\n                         if p2 >= 0 and t[p2] ==\'#\':\n                             backcount +=2\n             else:\n                 if p1 <0 or p2 <0:\n                     return False\n                 elif s[p1] != t[p2]:\n                     return False\n                 else:\n                     p1 -= 1\n                     p2 -= 1\n         return True\n\n```\n# Complexity\n- Time complexity: O(a+b)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->
['Two Pointers', 'String', 'Python']