Full Outer Join
Description
Given a left and a right table as arrays of [key, value] pairs (keys unique within each), return the full outer join as rows [key, leftValue, rightValue], using null where a side is missing. Order keys by first appearance in the left table, then keys that appear only on the right in their right-table order.
Examples
[[1,10],[2,20]], [[2,200],[3,300]][[1,10,null],[2,20,200],[3,null,300]]Every key from either table produces a row, filling in the value from each side when present and leaving the other empty when not.
[[1,1]], [[1,9]][[1,1,9]]Every key from either table produces a row, filling in the value from each side when present and leaving the other empty when not.
[[1,1],[2,2]], [][[1,1,null],[2,2,null]]Every key from either table produces a row, filling in the value from each side when present and leaving the other empty when not.
Constraints
- •
0 ≤ each table ≤ 10⁴ - •
keys unique within a table
Ready to solve this problem?
Practice solo and sharpen your skills for technical interviews.