I want to know difference between these two codes as one is giving me error and other is passing all test cases

ide:-https://ide.geeksforgeeks.org/AAzd5r4jW2

ide:-https://ide.geeksforgeeks.org/UNtXX6EuKU

hey @manikjindal49
in this loop

if(root->data==k){
        return 0;/////////
    }

you are just returning 0 but your min value isn’t updated for the recursion fucntion

but if we return 0 thats what we want na to get the returned value as 0 it doesnot matter our min value changes or not bcz at last the value we want is 0