Run error Delete nodes from BST

3 out of 5 test cases are giving run error ,please help me find the error,

hello @dhruvprashar

image

here u need to receieve ur updated root.
i.e it should be
root=deleteinbst(root,q);

Thank you, can u tell me why only 3 cases were giving this error although this statement is called in almost every case

incase of 0 deletion ,that loop will run 0 times hence no error for such cases