Tap here to switch tabs
Problem
Submissions

Problem: All Elements in Two Binary Search Trees

All Elements in Two Binary Search Trees gives you two binary search trees and asks for one array containing every value from both trees, including negative values, in ascending order.

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

All Elements in Two Binary Search Trees gives you two binary search trees and asks for one array containing every value from both trees, including negative values, in ascending order.

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