Last active
September 14, 2022 02:04
-
-
Save 1gravity/a1631b588786fc21b356f16f10772712 to your computer and use it in GitHub Desktop.
Kotlin Trie Search Optimized
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun search(key: String) = key.fold(root) { node, char -> | |
node.children[char] ?: return null | |
}.value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment