Some test cases are not passing

i dont what cases am i missing in the code please help sir…

Your logic to delete nodes is correct
but your way to build tree is not correct for this question
because here it is not mention to build balanced tree
you simply have to take nodes and then insert them into tree

see the modified Code below