1392. Longest Happy Prefix
https://leetcode.com/problems/longest-happy-prefix/
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: ""
Last updated