Marks :10
: 3 | : 0
You are given an array A of length N consisting of distinct elements.
You need to construct a Binary Search Tree(BST) by inserting each element one by one from array A, starting from the first element till last.
Determine the maximum path sum from root node to leaf node of the BST after each new element is inserted.
First line contains a single integer n (size of array or number of nodes) such that ($$$1 \le n \le 20000$$$).
Second line contains n space separated distinct integers $$$A_i$$$ where ($$$ 1 \le A_i \le 20000$$$).
Print the maximum path sum from root node to leaf node of the BST.
3 1 2 3
6
6 40 80 20 50 60 70
300
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.