Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Merge Sorted Customer ID Arrays

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Merge Sorted Customer ID Arrays. 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.

You need to log in / sign up to run or submit.

Problem

Given two sorted integer arrays arr1 and arr2, each representing customer IDs in non-decreasing order, return a new sorted array containing all unique IDs that appear in either array. The result must not contain duplicates, even if the same ID appears multiple times within one array or across both arrays.

Constraints

  • 0 <= len(arr1), len(arr2) <= 10^5
  • -10^9 <= arr1[i], arr2[i] <= 10^9
  • arr1 and arr2 are sorted in non-decreasing order

Function Signature

def merge_unique_sorted_ids(arr1, arr2):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output