Given the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus the sum of all keys greater than the original key in BST.
As a reminder, a binary search tree is a tree that satisfies these constraints:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right subtrees must also be binary search trees.
Problem Link : https://leetcode.com/problems/binary-search-tree-to-greater-sum-tree/description
Chapters:
0:00 - Problem Statement
0:34 - Drawing Explanation
01:35 - Python Code
03:47 - Java Code
Special thanks to Monesh S for creating the design thumbnail
https://github.com/Moneshai2004
Github : https://github.com/sheninthjr
LinkedIn : https://linkedin.com/in/sheninthjr
Twitter: https://twitter.com/sheninth_jr23
#leetcode #python #java #problemsolving #datastructures #algorithm #binarysearch #tamil
Download
0 formats
No download links available.
Binary Search Tree to Greater Sum Tree | Leetcode - 1038 | Tamil | Python | Java | NatokHD