Why are the test cases failing even though the output is correct?

Here is the link to my code -

Is there something wrong with my approach?
Since we know the inorder of a BST is always sorted so I sorted the array.
Building a BST using inorder is easy that’s why I chose it?
Why are the test cases failing?

hello @Vishesh-Chaitanya-1475805525886480

build a normal bst ( u r building balanced bst )

Even after building a normal bst , only 1 test case is getting passed?

pls share ur updated code .

Can you make relevant changes in my code so that all the test cases are passed? Link to my code - https://ide.codingblocks.com/s/436593

@Vishesh-Chaitanya-1475805525886480
check here->

@Aman Yadav Thankyou !

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.