Video Explanation (Intuitive solution)
Explanation\n\nhttps://youtu.be/yydoJ83WlHI\n\n# Code\n\nclass Solution {\n    vector<vector<int>> LongestCommonPrefixMatrix (string s) {\n        int n = s.len
# Explanation\n\nhttps://youtu.be/yydoJ83WlHI\n\n# Code\n```\nclass Solution {\n    vector<vector<int>> LongestCommonPrefixMatrix (string s) {\n        int n = s.length();\n        vector<vector<int>> result(n, vector<int>(n, 0));\n        \n        for (int j = 0; j < n; j ++) {\n            result[n-1][j] = result[j][n-1] = (s[j] == s[n-1])? 1 : 0; \n        }\n        for (int i = n-2; i >= 0; i --) {\n            for (int j = n-2; j >= 0; j --) {\n                result[i][j] = (s[i] == s[j])? 1 + result[i+1][j+1] : 0;\n            }\n        }\n        \n        return result;\n    }\n    \npublic:\n    string findTheString(vector<vector<int>>& lcp) {\n        int n = lcp.size();\n        \n        string result (n, \'a\');\n        \n        for (int i = 1; i < n; i ++) {\n            vector<bool> not_equal(26, false);\n            bool matched = false;\n            \n            for (int j = 0; j < i; j ++) {\n                if (lcp[j][i] == 0) {\n                    not_equal[result[j] - \'a\'] = true;\n                    continue;\n                }\n                \n                matched = true;\n                result[i] = result[j];\n                break;\n            }\n        \n            if (matched) continue;\n            for (int j = 0; j < 26; j ++) {\n                if (not_equal[j]) continue;\n                \n                result[i] = (char)(\'a\' + j);\n                break;\n            }\n        }\n        \n        if (LongestCommonPrefixMatrix(result) == lcp) return result;\n        return "";\n    }\n};\n```
['C++']