Tap here to switch tabs
Problem
Submissions

Problem: All Elements in Two Binary Search Trees

Try to solve the All Elements in Two Binary Search Trees problem.

Statement

Given the root nodes of two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order.

Constraints:

  • The number of nodes in each tree is in the range [0,5000][0, 5000].

  • −105≤-10^5 \leq Node.val ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: All Elements in Two Binary Search Trees

Try to solve the All Elements in Two Binary Search Trees problem.

Statement

Given the root nodes of two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order.

Constraints:

  • The number of nodes in each tree is in the range [0,5000][0, 5000].

  • −105≤-10^5 \leq Node.val ≤105\leq 10^5