Find the String with LCP
Code\n\nclass Solution {\npublic:\nstring findTheString(vector<vector<int>>& lcp) {\n    int n = lcp.size();\n    vector<int> Parent(n);\n    for(int i = 0;i < 
# Code\n```\nclass Solution {\npublic:\nstring findTheString(vector<vector<int>>& lcp) {\n    int n = lcp.size();\n    vector<int> Parent(n);\n    for(int i = 0;i < n;i++){\n        Parent[i] = i;\n    }\n    for(int i = n-1;i >= 0;i--){\n        for(int j = n-1;j >= 0;j--){\n            if( lcp[i][j] > min(n - i , n - j) ){\n                return "";\n            }\n            if(i == j && lcp[i][j]!=n-i){\n                return "";\n            }\n            if(i + 1 < n && j + 1 < n && lcp[i][j] == 1 + lcp[i+1][j+1]){\n                if(i < j){\n                    // cout << i << " "<< j<<endl;\n                    Parent[i] = Parent[j];\n                }\n            }\n            if(j == n-1 && lcp[i][j] == 1){\n                // cout << i << " "<< j<<endl;\n                Parent[i] = Parent[j];\n            }\n        }\n    }\n    char c = \'a\';\n    string s;\n    for(int i = 0;i < n;i++){\n        s = s + \'#\';\n        // cout<< Parent[i] << " ";\n    }\n    for(int i = 0;i < n;i++){\n        if(s[Parent[i]] == \'#\' && c <= \'z\'){\n            s[Parent[i]] = c;\n            s[i] = c;\n            c++;\n        }\n        else if(s[Parent[i]] == \'#\'){\n            return "";\n        }\n        else{\n            s[i] = s[Parent[i]];\n        }\n    }\n\n    vector<vector<int>> G(n,vector<int>(n,0));\n    for(int i=n-1;i >=0;i--){\n        for(int j=n-1;j>=0;j--){\n            int add = (s[i]==s[j]);\n            if(i+1 < n && j+1 < n && s[i]==s[j]){\n                add = add + G[i+1][j+1];\n            }\n            G[i][j] = add;\n            if(lcp[i][j] != G[i][j]){\n                return "";\n            }\n        }\n    }\n\n    return s;\n}\n\n};\n```
['C++']