Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
isEndOfWord Question

matthew.carnahan1

Jul 2, 2024

Imagine a trie that houses 2 words:

  1. car
  2. carton

Is the following trie correct:

Root - c - a - r - t - o - n

The nodes for 'r' and 'n' both have isEndOfWord = True, and the rest have isEndOfWord = False.

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

Yes, it is correct!

On this page