Company: Squarepoint
Difficulty: medium
Merge a List In Between You are given two integer sequences representing singly linked lists. Replace the inclusive 1-indexed segment from position `i` through position `j` in the first list with every element of the second list. Print the resulting list. Input Format The first line contains `n`, followed by a line with `n` integers for the first list. The next line contains `m`, followed by a line with `m` integers for the second list. The final line contains `i j`. Output Format Print the resulting values separated by spaces. Constraints `1 <= n, m <= 100000`, `1 <= i <= j <= n`; values fit in signed 32-bit integers. Example Input: `6` `1 4 6 3 2 7` `7` `5 6 4 3 8 2 1` `2 4` Output: `1 5 6 4 3 8 2 1 2 7` Notes The source's node-based interface is represented as arrays for this editor. The replacement is inclusive at both ends.