C++ easy O(n) solution 
IntuitionIf the number of not matching characters are greater then two then it is not possible to match the strings in single swap .
If the number of not matchi
![Screenshot 2025-02-05 210658.png](https://assets.leetcode.com/users/images/b20db7cb-6157-4c47-8505-6e366eff2a22_1738770318.5759323.png)

# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
If the number of not matching characters are greater then two then it is not possible to match the strings in single swap .
If the number of not matching characters are exactly two :
We have to check if it is possible to match the string by swapping those two elements .
if it matches then its true , else false.
# Approach
<!-- Describe your approach to solving the problem. -->
Implemented the intution , see the code it is self explanatory .
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
$$O(n)$$
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
$$O(1)$$
# Code
```cpp []
class Solution {
public:
    bool areAlmostEqual(string s1, string s2) {
        
        int change=0;
        string s_1="";
        string s_2="";
        for(int i=0;i<s1.size();i++)
        {
            if(s1[i]!=s2[i])
            { 
                if(change==0)
                {
                    s_1+=s1[i];
                    s_1+=s2[i];
                }
                else if(change==1)
                {
                   
                    s_2+=s1[i];
                    s_2+=s2[i];
                }
            // if the not matching character are more then 2 then it can't be done in single swap 
                else return false;
                change++;
            }
        }
    // if the characters need to interchange are same then true
         if(s_1[0]==s_2[1]  && s_1[1]==s_2[0] )
          return true;

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