Structurally identical trees

My code is not giving false output for any input
https://ide.codingblocks.com/s/63016
Can I use cin with a Boolean variable?
As in bool b;
cin>>b;
if(b==false)
{

}

You should use String then compare

1 Like

Hi Mohit, if you want to input a boolean value then take following kinds of input which means false:

  1. 0 as integer input
  2. “” i.e. blank string

Hope this helps :slight_smile:

1 Like

https://ide.codingblocks.com/s/66806
I have used string to compare now.
But still not getting any output.
Please help me out on this.

Hi Mohit, both your buildTree and checkidentical functions were not correct. I’ve made some modifications in your code and now it is working for all testcases. Go through the code and reply to this thread in case of any queries.
You can refer to the code here:
https://ide.codingblocks.com/s/66832

1 Like

Hello Ma’am.
Thankyou! I got to know my mistakes but I am unable to understand the use of having two parameters in the buildtree function. Can you explain that to me ?