Search
⌘K

Leetcode 2573. Find the String with LCP

Reconstruct the lexicographically smallest length-n lowercase string whose suffix-pair longest-common-prefix lengths match the given n×n lcp matrix, or return an empty string if no such string exists. The core challenge is checking consistency of the equality/inequality constraints implied by lcp entries across overlapping suffixes and assigning the smallest possible letters to each position.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.