You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given a binary tree, check if its balanced i.e. depth of left and right subtrees of every node differ by at max 1. Return true if given binary tree is balanced, false otherwise.
Input format
Elements in level order form (separated by space).
If any node does not have left or right child, take -1 in its place.
Output format boolean
The text was updated successfully, but these errors were encountered:
Question
Given a binary tree, check if its balanced i.e. depth of left and right subtrees of every node differ by at max 1. Return true if given binary tree is balanced, false otherwise.
Input format
Output format
boolean
The text was updated successfully, but these errors were encountered: