can you tell how to modify my code according to the question or how to use my pair function int the predefined function https://ide.codingblocks.com/s/335061
Please help me out
testcase 2 is not passing
@adarshsingh2k
There were two errors in your code.
if(isHeightBalanced(root).balance){
cout<<“true”;
}
else{
cout<<“false”;
}
In the if statement, you had used isHeightBalanced(root).height inplace of sHeightBalanced(root).balance. This was wrong because the balance parameter tells us if the tree is balanced or not.
Secondly, in case the tree was not balanced, you did not print “false”.
If my answer was able to resolve your query, please mark the doubt as resolved.