1392. Longest Happy Prefix
https://leetcode.com/problems/longest-happy-prefix
Description
A string is called a happy prefix if is a non-empty prefix which is also a suffix (excluding itself).
Given a string s
, return the longest happy prefix of s
. Return an empty string ""
if no such prefix exists.
Example 1:
Example 2:
Example 3:
Example 4:
Constraints:
1 <= s.length <= 105
s
contains only lowercase English letters.
ac
Last updated