I am not sure what exactly is going wrong here. I am using Trie, the rest is self explanatory:

```
const int ALPH_SIZE = 256;
struct Node{
char ch;
bool isWord;
vector<Node *> links;
Node(){
ch = 0;
isWord = false;
links.resize(ALPH_SIZE,NULL);
}
};
class Trie{
Node * myRoot;
public:
int myCount;
Trie(){
myRoot = new Node();
myCount = 1;
}
void insert(const string &s){
int len = s.size();
Node *t = myRoot;
for(int i = 0; i < len; ++i){
if(t->links[s[i]] == NULL){
t->links[s[i]] = new Node();
t = t->links[s[i]];
t->ch = s[i];
++myCount;
}
}
t->isWord = true;
}
string solve(){
Node *t = myRoot;
string ret = "";
while(t->isWord){
int cnt = 0, index = 0;
for(int i = 0; i < 256; ++i){
if(t->links[i] != NULL){ index = i; cnt++;}
}
if(cnt != 1) return ret;
t = t->links[index];
ret += char(t->ch);
}
ret += char(t->ch);
return ret;
}
};
class Solution {
public:
string longestCommonPrefix(vector<string> &strs) {
string ret = "";
if(strs.size() == 1) return strs[0];
if(strs.size() == 0) return ret;
Trie* myTrie;
myTrie = new Trie();
for(int i = 0; i < strs.size(); ++i){
myTrie->insert(strs[i]);
if(strs[i].size() == 0) return ret;
}
return(myTrie->solve());
}
};
```

I am getting a wrong answer in this manner:

Input: ["a","b"]

Output: ""

Expected: ""

what exactly am I missing here?