Skip to content

Instantly share code, notes, and snippets.

@ik11235
Created January 2, 2015 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ik11235/4674f57744bd886bc32b to your computer and use it in GitHub Desktop.
Save ik11235/4674f57744bd886bc32b to your computer and use it in GitHub Desktop.
class LostCharacter {
public:
vector<int> getmins(vector<string> str) {
vector<int> ans(str.size());
for(int i=0;i<str.size();i++)
{
vector<string> tmp=str;
string target;
for(int j=0;j<tmp.size();j++)
{
for(int k=0;k<tmp[j].size();k++)
if(tmp[j][k]=='?')
{
if(i==j)
tmp[j][k]='a';
else
tmp[j][k]='z';
}
}
target=tmp[i];
sort(tmp.begin(),tmp.end());
ans[i]=find(tmp.begin(),tmp.end(), target)-tmp.begin();
}
return ans;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment