Accenture coding questions and answers July 2023 | MergeStrings problem solution in python

Опубликовано: 26 Июль 2023
на канале: Engineers Revolution
225
3

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


Смотрите видео Accenture coding questions and answers July 2023 | MergeStrings problem solution in python онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Engineers Revolution 26 Июль 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 225 раз и оно понравилось 3 людям.