Question No: 02 MergeStrings
You are given a functon
def MergeStrings(str1, str2)
The function accepts strings str1 and str2
for i = 0, on comparing characters at index 0 of input strings, smaller character is placed at index 0
and larger character is placed at index n-1
for i = 1, on comparing characters at index 1 of input strings, smaller character is placed at index 1
and larger character is placed at index n-2
for i = k, on comparing characters at index 1 of input strings, smaller character is placed at index k
and larger character is placed at index n-k-1
where k less than n and n is the length of output string (length of str1 + length of str2)
Return null if both the string are null
Return other string if one of the string is null
Null refers to None in case of python
If length is not same, the rest of the characters are added on their original positions.
Input
str1: are
str2: denim
Output
aeeimnrd
Watch video Accenture coding questions and answers July 2023 | MergeStrings problem solution in python online without registration, duration hours minute second in high quality. This video was added by user Engineers Revolution 26 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 225 once and liked it 3 people.