Run error in 4 test cases

here is my code:


pls check it for run error.

hello @Garvit012
image
add this if statement in ur code.

ur updated code->

Thanks for the suggestion but can you explain why do we need it since in the question it says the node to be deleted will definitely be in the tree

probably some test cases are not following this constriant->

otherwise ur code should work fine without adding that if statement

okay thankyou for your help