ANTARNAB || JAVA || 100% FASTER || EASY
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 {\n    public String findTheString(int[][] lcp) {\n        int n = lcp.length;\n        \n        // potential answer\n        char [] arr = new char [n];\n        arr[0] = \'a\';\n        \n        char test;\n        boolean found;\n        \n        for (int i = 1; i < n; ++i) {\n            test = \'a\';\n            found = false;\n            \n            for (int j = 0; j < i; ++j){\n                test = (char)Math.max(test, arr[j]);\n                \n                if (lcp[i][j] != 0){\n                    found = true;\n                    arr[i] = arr[j];  \n                    break;\n                }    \n            }\n            \n            if (found)\n                continue;\n            \n            ++test;\n            arr[i] = test;\n            \n            \n            // More than 26 characters needed. \n            if (test > \'z\')\n                return "";\n        }\n        \n        // lcp from potential string\n        int [][] dp = new int [n + 1][n + 1];\n        \n        int val;\n        \n        for (int i = n - 1; i >= 0; --i){\n            for (int j = n - 1; j >= 0; --j) {\n                if (arr[i] != arr[j])\n                    val = 0;\n                else\n                    val = 1 + dp[i + 1][j + 1];\n                \n                dp[i][j] = val;\n            }\n        }\n        \n        // compare dp and lcp as both should be same\n        for (int i = n - 1; i >= 0; --i){\n            for (int j = n - 1; j >= 0; --j) {\n                if (dp[i][j] != lcp[i][j])\n                    return "";\n            }\n        }\n        \n        return String.valueOf(arr);\n    }\n}\n```
['Java']