Your question is Combining Arrays Into Sorted Output. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Meta's Scuba-style observability workflows may receive event identifiers from two unsorted sources with different batch sizes. Implement a function that combines both arrays and returns all values in nondecreasing order.
Given two arrays first and second of integers, return a new array containing every element from both inputs exactly once per occurrence, sorted from smallest to largest. The input arrays may have different lengths and may be empty. Do not modify either input array.
Your solution should use an appropriate comparison-based sorting approach and should handle duplicate and negative values.
def combine_and_sort(first, second):