Interleave Two Strings
Problem statement
You are given two strings, first and second. Build a result by taking one character from first, then one from second, and repeating.
The first result character comes from first. When one string is exhausted, append the remaining suffix of the other string.
Function
interleaveStrings(first: String, second: String) → StringExamples
Example 1
first = "aaaaa"second = "bbb"return = "abababaa"The first six characters alternate, then the two unused characters from the first string are appended.
Example 2
first = ""second = "abc"return = "abc"The first string is empty, so the complete second string is appended.
Constraints
0 <= first.length,second.length <= 100000- Both strings contain lowercase English letters.