Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Password Creation

Home > Programs > Strings

376 / 59

Password Creation

A password manager wants to create a new password using two strings given by the user, then combined to create a harder-to-guess combination. Given two strings, interleave the characters of the strings to create a new string. Beginning with an empty string, alternately append a character from string a and from string b. If one of the strings is exhausted before the other, append the remaining letters from the other string all at once. The result is the new password.

If a = saplab and b = q4interview ,the result is sqa4pilnatberview.

Function Description
Complete the function newPassword in the editor below
newPassword has the following parameter(s):
string a the first string
string b the second string

Show Full Paragraph


Asked In :: SAP Labs HackerRank

Post Your Answer Here: