Just a tought came in mind till now i have make maps of strings and vectors
Like this
map<int,int> m; map <int,vector<int>> m; map <string,vector<int>> m;
and various combinations are possible with other data types also.
But what will happen If I do
map <vector<int>,vector<int>> m; or map <vector<int>,vector<vector<int>>> m;
etc.
I was solving a question leetcode in which this format could be helpfull https://leetcode.com/contest/biweekly-contest-90/problems/odd-string-difference/ I tried like this
class Solution {
public:
string oddString(vector<string>& words) {
map <vector<int>,vector<string>> m;
for(auto i:words)
{
// m[{int(i[0]-i[1]), int(i[1]-i[2])}].push_back(i);
vector<int> v;
for(int j=1;j<i.size();j++)
{
v.push_back(int(i[j]-i[j-1]));
}
}
for(auto i:m)
{
if(i.second.size() ==1)
{
return i.second[0];
}
}
return "";
}
};