PYTHON CHECK ALL SWAPS
Intuition / Approach\nJust check everything against everything. Because the input size is so small.\n\nSo find all swaps of the first string (including 0 swaps)
# Intuition / Approach\nJust check everything against everything. Because the input size is so small.\n\nSo find all swaps of the first string (including 0 swaps). And the same for the second. And then check them against each other.\n\n# Complexity\n- Time complexity:\nConstant time complexity given the constraints.\n\n- Space complexity:\nConstant space complexity given the constraints\n\n# Code\n```python3 []\nclass Solution:\n    def canBeEqual(self, s1: str, s2: str) -> bool:\n\n        s1_candidates = self.findCandidates(s1)\n        s2_candidates = self.findCandidates(s2)\n\n        # print(s1_candidates)\n        # print(s2_candidates)\n\n        for each_candidate in s1_candidates:\n            if each_candidate in s2_candidates:\n                return True\n\n        return False\n\n    def findCandidates(self, input_str:str) -> set[str]:\n        """Finds all expansions of 4 digit chars with legal swaps."""\n        print(\'start\')\n        candidates = set()\n        candidates.add(input_str)\n        print(\'\'.join(input_str))\n        expanded_str = [each_char for each_char in input_str]\n        expanded_str[0], expanded_str[2] = expanded_str[2], expanded_str[0]\n        # print(\'\'.join(expanded_str))\n        candidates.add(\'\'.join(expanded_str))\n        expanded_str[1], expanded_str[3] = expanded_str[3], expanded_str[1]   \n        # print(\'\'.join(expanded_str))\n        candidates.add(\'\'.join(expanded_str))\n        expanded_str[0], expanded_str[2] = expanded_str[2], expanded_str[0]\n        candidates.add(\'\'.join(expanded_str))\n        # print(\'\'.join(expanded_str))\n        # print(\'end\')\n        return candidates\n```
['Python3']