Skip to content

Instantly share code, notes, and snippets.

@1gravity
Created September 13, 2022 15:51
Show Gist options
  • Save 1gravity/62270263c514eae306b8e978e1aa17ba to your computer and use it in GitHub Desktop.
Save 1gravity/62270263c514eae306b8e978e1aa17ba to your computer and use it in GitHub Desktop.
Kotlin Trie Optimized Incomplete Insert
fun insert(key: String, value: Value) {
key.fold(root) { node, char ->
node.children[char]
}.value = value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment