Can anyone match this with any Algorithm problem? or what's the best way to solve this?
I have two arrays
arr1 = [A, B]
arr2 = [1, 2]
Result: [A1, A2, B1, B2]
Scenario 2:
arr1 = []
arr2 = [1, 2]
Result: [1, 2]
Scenario 3:
arr1 = [A, B]
arr2 = []
Result: [A, B]
Scenario 4:
arr1 = []
arr2 = []
Result: []
I have started with the below but that is not covering all the scenarios above
array1.flatMap(d => array2.map(v => d + v)) // Not covering scenario 2 and 3
Scenario 4 can be covered easily with a 0-length check in the beginning.