O(n)- time complexity .. simple approach
Intuition: first to check if both the string is same then there is no need to swap. if both the string is different then if we see the maximum character that ca
# Intuition: first to check if both the string is same then there is no need to swap. if both the string is different then if we see the maximum character that can different in both the string will be two the check on those two character is equal or not.

<!-- Describe your first thoughts on how to solve this problem. -->

# Approach: first check both string is equal if it's then return true then there is two pointer check both string and place two pointers on that point where character are different the check s1[first] == s2[second] && s1[second] == s2[first]
<!-- Describe your approach to solving the problem. -->

# Complexity: O(n)
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    bool areAlmostEqual(string s1, string s2) {
        if (s1 == s2){
            return true;
        }

        int count = 0;
        int first = -1, second = -1;
        for (int i = 0; i < s1.size(); i++){
            if (s1[i] != s2[i]){
                count++;
                if (count == 1){
                    first = i;
                } else if(count == 2) {
                    second = i;
                } else {
                    return false;
                }
            }
            
        }

        if (count == 2 && s1[first] == s2[second] && s1[second] == s2[first]){
            return true;
        }

        return false;
    }
};
```
['C++']