2/4 test cases being passed

Your code is giving true for every input. There is some issue with your build tree function.Cross check that.
Refer this to check how exactly you have to build the tree Structurally identical tree

The only difference is that I’ve passed bool data type parameter and you have passed string type parameter. Still I am not getting the output. Please explain

Take true and false in the form of string. If it is taken as a bool variable, it will expect input as 0 and 1. But here it is given “true” and “false” as input so it will not behave as expected.
It turns out that std::cin only accepts two inputs for Boolean variables: 0 and 1 ( not true or false). Any other inputs will cause std::cin to silently fail.
Check the behavior from here https://ide.codingblocks.com/s/243850

Gotcha! Thanks @pratyush63