Building possible candidate + DP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n = lcp.size();\n        string ans(n , \'#\');\n\n        char cur = \'a\';\n\n        for(int i = 0; i < n; i++) {\n            if(ans[i] == \'#\') {\n                ans[i] = cur;\n                if(cur > \'z\') return "";\n                cur++;\n\n                for(int j = i + 1; j < n; j++) {\n                    if(lcp[i][j] > 0) {\n                        ans[j] = ans[i];\n                    }\n                }\n            } \n        }\n\n        int dp[n + 1][n + 1];\n        memset(dp , 0 , sizeof(dp));\n\n        for(int i = n - 1; i >= 0; i--) {\n            for(int j = 0; j < n; j++) {\n                if(ans[i] == ans[j]) {\n                    dp[i][j] = 1 + dp[i + 1][j + 1];\n                }\n            }\n        }\n\n        for(int i = 0; i < n; i++) {\n            for(int j = 0; j < n; j++) {\n                if(dp[i][j] != lcp[i][j]) {\n                    return "";\n                }\n            }\n        }\n        return ans;\n    }\n};\n```
['C++']