Data Structures & Algorithms
237 notes
Some notes are currently available only in Chinese. English translations are shown when available.
- Reconstruct Binary Treehistorical
Given the preorder traversal and inorder traversal results of a binary tree, reconstruct the binary tree. Assume that the input preorder traversal and inorder traversal results contain no duplicate numbers.
- House Robber IIIhistorical
Houses form a binary tree, and a parent and its child cannot both be robbed. Choose houses that maximize the total amount stolen.
- Paths in a Binary Tree With a Given Sumhistorical
Given the root node of a binary tree and an integer, print all paths in the binary tree whose node values sum to the given integer. A path is defined as the nodes traversed from the root node of the tree downward to a leaf node.
- Sum Root to Leaf Numbershistorical
Each binary-tree node contains a digit from 0 to 9. Root-to-leaf paths form integers; return their total sum.
- Serialize a Binary Treehistorical
Implement two functions to serialize and deserialize a binary tree respectively.
- Convert a String to an Integerhistorical
Convert a string to an integer without using a library function that converts strings to integers. Return 0 if the value is 0 or if the string is not a valid numeric value.
- Path Sum IIIhistorical
Count downward paths in an integer-valued binary tree whose sum equals a target. Paths need not start at the root or end at a leaf.
- Reverse Word Orderhistorical
Reverse the order of words in an English sentence while preserving the character order within each word.