LCA for Binary search tree

what is wrong with my code.pls help me to identify it.

hi @dips123deepali_c25f140838182212
u were taking input for BST till its not -1… but u have to take input of n numbers… also nodes whose LCA was to be found out, u were not inputting those nodes…
corrected code -->


It’s working fine now…

Got it…Thank you

1 Like

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.

can u give me solution in java?