✅✅Beats 100%🔥C++🔥Python|| 🚀🚀Super Simple and Efficient Solution🚀🚀||🔥Python🔥C++✅✅
Complexity
Time complexity: O(n)

Space complexity: O(n)
⬆️👇⬆️UPVOTE it⬆️👇⬆️Code⬆️👇⬆️UPVOTE it⬆️👇⬆️
# Complexity
- Time complexity: $$O(n)$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: $$O(n)$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
⬆️👇⬆️UPVOTE it⬆️👇⬆️
# Code
```cpp []
class Solution {
 public:
  bool areAlmostEqual(string s1, string s2) {
    vector<int> diffIndices;
    for (int i = 0; i < s1.length(); ++i){
      if (s1[i] != s2[i])
        diffIndices.push_back(i);
    }
    return diffIndices.empty() || (diffIndices.size() == 2 && s1[diffIndices[0]] == s2[diffIndices[1]] && s1[diffIndices[1]] == s2[diffIndices[0]]);
  }
};
```
```python []
class Solution:
  def areAlmostEqual(self, s1: str, s2: str) -> bool:
    diffIndices = [i for i, (a, b) in enumerate(zip(s1, s2))
                   if a != b]
    return not diffIndices or (len(diffIndices) == 2 and s1[diffIndices[0]] == s2[diffIndices[1]] and s1[diffIndices[1]] == s2[diffIndices[0]])
```
⬆️👇⬆️UPVOTE it⬆️👇⬆️
['Hash Table', 'String', 'Counting', 'C++', 'Python3']