← 返回 bytedance 的题目列表CRUD Operations in Trie
类型:online_judge
Implement a Trie data structure that supports CRUD (Create, Read, Update, Delete) operations. In particular, implement the update and delete operations. For the delete method, ensure correct handling of empty nodes that may arise during deletion.
Input and Output Examples:
Create a Trie and insert the string "apple", then read "apple", expect a return of true.
Update the string "apple" in the Trie to "apples", then read "apples", expect a return of true.
Delete the string "apples" in the Trie, then read "apples", expect a return of false.
Data Scale:
The number of strings does not exceed 1000.
The length of each string does not exceed 100.
Example
Input
insert apple
search apple