Reported September 2026
Oraclearray

Merge One List Between Two Positions

Reported by candidates from Oracle's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Oracle OA. Under 2s to a working solution.
Founder's read

The Oracle OA reported in September 2026 looks like a linked-list problem, but the input is plain arrays, and that's where people trip. Merge One List Between Two Positions asks you to cut indices a through b out of list1 and drop list2 in their place. The edge cases are what break a quick solution: a equal to 0, b equal to the last index, and an empty list2. If you blank on slicing boundaries, StealthCoder runs invisibly during the live OA and gives you a working answer as a safety net. Still, this one is simple once you see it.

The problem

list1 and list2 contain linked-list node values in traversal order. Remove the inclusive range of nodes from index a through index b in list1, and splice all nodes of list2 in their place.
Return the resulting node values.

Function
mergeInBetween(list1: int[], a: int, b: int, list2: int[]) → int[]

Examples
Example 1
list1 = [0,1,2,3,4,5]
a = 3
b = 4
list2 = [1000000,1000001,1000002]
return = [0,1,2,1000000,1000001,1000002,5]
Values at indices 3 and 4 are replaced by the second list.
Example 2
list1 = [1,2,3]
a = 0
b = 2
list2 = [9]
return = [9]
Replacing the full first list leaves only the inserted list.

Constraints
1 <= list1.length <= 100000.
0 <= a <= b < list1.length.
0 <= list2.length <= 100000.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that it's just array slicing. Take list1 from 0 up to a (exclusive), append all of list2, then append list1 from b+1 to the end. Three pieces, one pass, O(n + m) time. The pitfall is off-by-one errors. The range is inclusive, so the tail starts at b+1, not b. Check your slices against Example 2, where a is 0 and b is the last index, so both the head and tail come out empty and only list2 remains. Also handle an empty list2, which should simply delete the range. Don't simulate pointers or shift elements one by one in a loop, since with lists of 100000 that can turn quadratic. If the assessment goes sideways and you freeze on the boundaries, StealthCoder is the hedge that reads the problem and hands you the slice logic live.

The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.

If this hits your live OA

You can drill Merge One List Between Two Positions cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as merge in between linked lists. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Oracle's OA.

Oracle reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Merge One List Between Two Positions FAQ

How hard is the Oracle Merge One List Between Two Positions question really?+

Easy. It's a boundary problem, not an algorithm problem. The only real risk is off-by-one mistakes on the inclusive range. If you can slice an array and concatenate three pieces, you can solve it in a few minutes.

What's the trick to solving it?+

Build the result as head plus list2 plus tail. Head is list1[0:a], tail is list1[b+1:]. Concatenate them in order. No pointer manipulation is needed because the input and output are arrays of values.

Which edge cases should I test first?+

Test a = 0, b = last index, and an empty list2. Example 2 covers the full replacement case. With an empty list2, the result should be list1 with the range removed. Also try a equal to b to check single-element removal.

Will this be efficient enough for 100000 elements?+

Yes, if you use slicing or a single pass. That's O(n + m) time. Avoid removing or inserting elements one at a time in the middle of an array, since each shift costs O(n) and the total can get slow.

How do I prepare for this in 48 hours?+

Practice array slicing boundaries in your language of choice and walk through both examples by hand. Then look at the linked-list version of the same idea, in case the assessment variant uses real nodes. Focus on inclusive versus exclusive indices.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Oracle.

OA at Oracle?
Invisible during screen share
Get it