ds-algo-study
Version:
Just experimenting with publishing a package
44 lines (41 loc) • 1.96 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="A description of the page and its contents"
/>
<link rel="stylesheet" href="styles.css" />
<title>Page Title</title>
<link rel="stylesheet" href="./../../../../assets/style.css" />
<link rel="stylesheet" href="./../../../../assets/prism.css" />
<script async src="./../../../../assets/prism.js"></script>
</head>
<body>
<h1 id="balanced-binary-tree---leetcode">Balanced Binary Tree - LeetCode</h1>
<blockquote>
<p>Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.</p>
</blockquote>
<p>Given a binary tree, determine if it is height-balanced.</p>
<p>For this problem, a height-balanced binary tree is defined as:</p>
<blockquote>
<p>a binary tree in which the left and right subtrees of <em>every</em> node differ in height by no more than 1.</p>
</blockquote>
<p><strong>Example 1:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/10/06/balance_1.jpg" /></p>
<p><strong>Input:</strong> root = [3,9,20,null,null,15,7] <strong>Output:</strong> true</p>
<p><strong>Example 2:</strong></p>
<p><img src="https://assets.leetcode.com/uploads/2020/10/06/balance_2.jpg" /></p>
<p><strong>Input:</strong> root = [1,2,2,3,3,null,null,4,4] <strong>Output:</strong> false</p>
<p><strong>Example 3:</strong></p>
<p><strong>Input:</strong> root = [] <strong>Output:</strong> true</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in the tree is in the range <code>[0, 5000]</code>.</li>
<li><code>-104 <= Node.val <= 104</code></li>
</ul>
<p><a class="btn" href="https://leetcode.com/problems/balanced-binary-tree/">Source</a></p>
</body>
</html>