FastPrepMerge Two Sorted Arrays
Problems/Merge Two Sorted Arrays

Merge Two Sorted Arrays

Rippling logoRippling● EasyINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Rippling intern phone screen. The report names merging two sorted arrays but gives no interface or extra rules. We chose to return a new array, how to treat repeated values, and the limits. Our version is about 80% the same as the reported question.

You are given two integer arrays, first and second, each sorted from smallest to largest. Return a new array containing all values from both inputs, also sorted from smallest to largest.

Keep every occurrence, including repeated values within either input and values present in both arrays. Either input may be empty.

Function

mergeSortedArrays(first: int[], second: int[]) → int[]

Examples

Example 1

first = [1,4,4]second = [2,4,7]return = [1,2,4,4,4,7]

Every occurrence of 4 remains.

Example 2

first = []second = [0,3]return = [0,3]

An empty input contributes no values.

Example 3

first = [-5,-1,6]second = [-3,6]return = [-5,-3,-1,6,6]

Negative values and both copies of 6 are retained.

Constraints

  • 0 <= first.length, second.length <= 10^5.
  • The combined length is at most 2 * 10^5.
  • Values are signed 32-bit integers.
  • Both inputs are sorted in nondecreasing order.

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Majority ElementByteDance · PHONE SCREENByteDance interview questions
  • Recommend Films from Viewers Who Watched Everything You DidBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Total Years of Work ExperienceLinkedIn · PHONE SCREENLinkedIn interview questions
  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Squares of a Sorted ArrayInstacart · PHONE SCREENInstacart interview questions
  • Assign CookiesAmazon · PHONE SCREEN
  • Sort by Checking PermutationsMercor · PHONE SCREENMercor interview questions
  • Meeting RoomsGoldman Sachs · PHONE SCREEN · ONSITE INTERVIEWGoldman Sachs interview questions
  • Parse and Sort Integer DataLegora · PHONE SCREEN

Interview reports that mention this question

  • Rippling Intern Phone Screens: 28 Experiences (Part 3 of 5)
  • Rippling SWE Intern Interviews: 101 Experiences (Part 1 of 5)

Rippling interview experiences

  • Rippling Senior SWE Full Loop Questions: 1 Experience
  • Rippling Experienced SWE Phone Screens: 2 Experiences
  • Rippling Design Rounds and Onsites: 17 Experiences (Part 3 of 3)
  • Rippling Phone Coding Screens: 14 Experiences (Part 2 of 3)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int[] mergeSortedArrays(int[] first, int[] second) {
        // Write your code here.
    }

}
Checking account…