1392. Longest Happy Prefix
Description
**Input:** s = "level"
**Output:** "l"
**Explanation:** s contains 4 prefix excluding itself ("l", "le", "lev", "leve"), and suffix ("l", "el", "vel", "evel"). The largest prefix which is also suffix is given by "l".**Input:** s = "ababab"
**Output:** "abab"
**Explanation:** "abab" is the largest prefix which is also suffix. They can overlap in the original string.**Input:** s = "leetcodeleet"
**Output:** "leet"**Input:** s = "a"
**Output:** ""ac
Last updated