|
U
Pro397. Implement Trie with Wildcard Character Matching
Hard
Problem Description
Implement a trie with wildcard character matching.
Input Format
A single line containing string S.
Output Format
Print the computed string or integer scalar.
Example 1:
Input:
racecar
Output:
true
Explanation: "racecar" reads identically forward and backward.
Example 2:
Input:
hello
Output:
false
Explanation: "hello" is not a palindrome.
Example 3:
Input:
a
Output:
true
Explanation: A single character string is trivially symmetric.
Constraints:
1 <= length(S) <= 10^5Characters consist of printable ASCIITime complexity target: O(N)Auxiliary space target: O(1) or O(N)
Follow up:Can this algorithm be adapted to an online streaming setting where the entire input cannot be held in memory simultaneously?
1,180 Online
Code
|Loading Code Editor...
SavedLn 1, Col 1
input =
Sandboxed Engine
Ctrl+Enter = Run | Ctrl+Shift+Enter = Submit