RedHat OA | Find the String: Reconstructing a String from an LCP Matrix
Question · Posted Apr 2026
Problem Statement: Find the String The Scenario: There was a hidden string S of length n made of lowercase English letters. This string was used to generate a 2-dimensional array lcp[n][n]. The Definition: lcp[i][j] is equal to the length of the Longest Common Prefix between the substring starting at index i (S[i…n]) and the substring starting at index j (S[j…n]). The Task: Given the lcp array, which may have been corrupted, return the lexicographically smallest string of length n that ...
The full answer & interview discussion are available to premium members.
Log in Create a free account