Skip to content
DeepForgeby svx
All problems
EasyData Structuresds-238

Rope Concat

Problem

Concatenate two ropes represented as lists of string chunks.

A rope keeps a string as an ordered list of chunks. Concatenation returns a new rope whose chunks are the first rope's followed by the second's, reusing both inputs.

Return the concatenated chunk list.

Hint

Concatenating ropes is just concatenating their chunk sequences.

Test cases

case 1
in: [["ab","cd"],["ef"]]
expected: ["ab","cd","ef"]
case 2
in: [[],["x"]]
expected: ["x"]
case 3
in: [["x"],[]]
expected: ["x"]
case 4
in: [[],[]]
expected: []
Starter codePython
def rope_concat(a, b):
    # Your code here
    pass

4 test cases · run your code against them in the editor