java.lang.Object
g1301_1400.s1305_all_elements_in_two_binary_search_trees.Solution

public class Solution extends Object
1305 - All Elements in Two Binary Search Trees.<p>Medium</p> <p>Given two binary search trees <code>root1</code> and <code>root2</code>, return <em>a list containing all the integers from both trees sorted in <strong>ascending</strong> order</em>.</p> <p><strong>Example 1:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2019/12/18/q2-e1.png" alt="" /></p> <p><strong>Input:</strong> root1 = [2,1,4], root2 = [1,0,3]</p> <p><strong>Output:</strong> [0,1,1,2,3,4]</p> <p><strong>Example 2:</strong></p> <p><img src="https://assets.leetcode.com/uploads/2019/12/18/q2-e5-.png" alt="" /></p> <p><strong>Input:</strong> root1 = [1,null,8], root2 = [8,1]</p> <p><strong>Output:</strong> [1,1,8,8]</p> <p><strong>Constraints:</strong></p> <ul> <li>The number of nodes in each tree is in the range <code>[0, 5000]</code>.</li> <li><code>-10<sup>5</sup> <= Node.val <= 10<sup>5</sup></code></li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details