Problem statement

https://binarysearch.com/problems/Swap-Characters-to-Equalize-Strings/

Solution

Just check that we have even number of each letter in s + t.

Complexity

It is O(n) for time and space.

Code

class Solution:
    def solve(self, s, t):
        return all(x % 2 == 0 for x in Counter(s + t).values())