All Posts

Leetcode 429: N-ary Tree Level Order Traversal

You are given an n-ary tree where each node contains a value and a list of its children. Your task is to return the level order traversal of the tree’s nodes. Nodes are grouped by their level, with the root node at level 0. Each node’s children are separated by a null value in the level order serialization.

Leetcode 437: Path Sum III

You are given the root of a binary tree and an integer targetSum. Your task is to count the total number of paths in the tree where the sum of node values along the path equals targetSum. The path does not need to start or end at the root or a leaf, but it must go downwards (from parent to child nodes).

Leetcode 449: Serialize and Deserialize BST

Design an algorithm to serialize and deserialize a binary search tree (BST). Serialization is converting the tree to a string format, while deserialization reconstructs the tree from this string. The goal is to ensure that the BST can be serialized to a compact string and can be accurately deserialized back into the original tree structure.

Leetcode 501: Find Mode in Binary Search Tree

Given the root of a binary search tree (BST) with possible duplicates, return the mode(s) (i.e., the most frequently occurring element) in the tree. If there are multiple modes, return them in any order.

Leetcode 508: Most Frequent Subtree Sum

Given the root of a binary tree, return the most frequent subtree sum. A subtree sum is the sum of all the node values in the subtree rooted at any node, including the node itself. If there is a tie, return all the subtree sums with the highest frequency.

Leetcode 513: Find Bottom Left Tree Value

Given the root of a binary tree, return the leftmost value in the last row of the tree.