Coding Interviews: Simple Data Structures
Collapse
AllJavascriptEasyMediumHardVideoPythonCode SolutionJava
Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.
Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).
Implement the Trie class:
Trie() Initializes the trie object.
void insert(String word) Inserts the string word into the trie.
boolean search(String word) Returns true if the string word is in the trie (i.e., was inserted before), and false otherwise.
boolean startsWith(String prefix) Returns true if there is a previously inserted string word that has the prefix prefix, and false otherwise.