Is_balanced failed 3rd test case


I followed the same approach of prateek bhaiya. I am just confused is binary tree in preorder format is here something different . Whether I should change my input lines of tree.


i have modified you code you can see
you have done two mistakes

  1. height is max(left.height,right.height)+1;
  2. else balanced =false;

if you like hit like button

1 Like