Tenable Interview Question: Given two strings, merge them... | Glassdoor

Interview Question

QA Automation Engineer Interview New York, NY

Given two strings, merge them -> so that "abc" and "def

 " becomes "adbecf" for example"
Answer

Interview Answer

3 Answers

This post has been removed.
Please see our Community Guidelines or Terms of Service for more information.

0

while ( *first != '\0' && *second != '\0') {
       *combine++ = *first++;
       *combine++ = *second++;
    }
    *combine='\0';

Anonymous on Jan 14, 2018
0

Python code

```
chars = 'abcdef'
''.join([chars[idx] + chars[idx + 3] for idx in range(int(len(chars) / 2))])
```

Returns: adbecf

Anonymous on May 21, 2018

Add Answers or Comments

To comment on this, Sign In or Sign Up.