You are given a binary tree with n nodes, where each node contains node.val coins. There are exactly n coins in total across the tree. In one move, you can transfer a coin between two adjacent nodes (parent to child or child to parent). Return the minimum number of moves required to ensure that every node has exactly one coin.
You are given the root of a binary tree, where each node contains a value between 0 and 25, corresponding to letters from ‘a’ to ‘z’. Your task is to find the lexicographically smallest string that can be formed by traversing from a leaf node to the root node, using the values in each node as letters.
You are given a grid of size m x n where each cell is either land (1) or sea (0). Your task is to determine the number of land cells that are completely enclosed by sea cells. A land cell is considered enclosed if it cannot reach the boundary of the grid via other land cells.
You are given the root of a binary tree. Your task is to find the maximum absolute difference between the values of two nodes, where one node is an ancestor of the other. Specifically, you need to find the largest value of |a.val - b.val|, where node a is an ancestor of node b.
You are given an m x n grid of integers where each value represents the color of a cell. You are also given three integers: row, col, and color. The task is to change the color of the border of the connected component containing the cell at grid[row][col]. A connected component is defined as a group of adjacent cells that have the same color. A border cell is a cell that is either adjacent to a different color cell or is on the boundary of the grid. You should return the updated grid where the border of the connected component is colored with the specified color.
Given the root of a Binary Search Tree (BST), convert it into a Greater Tree where each node’s value is updated to the sum of its original value and all the values greater than it in the BST. The transformation should preserve the BST structure.