Beginner Friendly | Solution with approach🐐 | 0ms Beats 100%
IntuitionHere we will take use of unordered_set as by doing this we can do this problem in one pass with help of it, else it will take nested loops that's not t
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
Here we will take use of unordered_set as by doing this we can do this problem in one pass with help of it, else it will take nested loops that's not the perfect approach

# Approach
<!-- Describe your approach to solving the problem. -->
1. Make an unordered_set & we need to insert element in that `set` cautiously
2. We will use a simple `for loop` for traversing `words` vector
3. Traverse in `words` vector and reverse each element of the `words` vector
4. After that we need to check whether the reversed string already present in `set` or not
5. To check if it exists `s.find(rev)!=s.end()` and this will tell that the searched string already `exists` in the set, So simply we need to do `count++` thus giving us one `string pair`.
6. And if the String is not present in the set then we will simply insert the String in set `s.insert(words)`
7. At last simply return `count` that will tell us maximum number of string pairs

# Complexity
- Time complexity: O(1)
<!-- 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:
    int maximumNumberOfStringPairs(vector<string>& words) {
        int n = words.size();
        unordered_set<string> s;
        int count = 0;
        for(int i = 0;i<n;i++){
            string rev = words[i];
            reverse(rev.begin(),rev.end());
            if(s.find(rev)!=s.end()) count++;
            else s.insert(words[i]);
        }
        return count;
    }
};
```
['C++']