Infosys Pre-Training Assessment || String shuffle Solution || All TestCases Passed

preview_player
Показать описание
🔔 Subscribe for more solution updates! 🔔

Don't forget to like 👍, share 📲 with your friends

Instagram :

📌Telegram :

Question :

Consider two non-empty input strings of alphabets instr1, instr2 and a non-zero positive integer innym.Generate and print the output string outstr based on the below logic

* Starting from the leftmost alphabet, identify innum number of alphabets from instr1 and instr2

* Add the identified alphabets from instr1 followed by instr2 to outstr

* Repeat the above two steps, identifying and the subsequent innum number of alphabets from instr1 and instr2 until either instr1 or instr2 or both have less than innum characters left for processing

* Add the remaining alphabets (if any) in instr1 followed by remaining alphabets (if any) in instr2 to the end of outstr

* If innum is greater than the total number of alphabets in any of the input strings, then take both input strings completely and process in the same order.
Input Format:

First line contains instr1.

Second line contains instr2.

Third line contains innum.

Read the input from the standard input stream.

Output format:

Print the output outstr to the standard output stream.

Sample Test Cases

Case 1

Input:

Industry

Ready

7

Output:

Industry Ready

Explanation:

For the given inputs, instr1 is 'Industry', instr2 is 'Ready' and innum is 7. innum is greater than total number of characters in instr2 i.e.,5. Hence process instr1 and instr2 in order by adding instr1 completely to outstr followed by instr2 completely to outstr resulting in 'IndustryReady'.

Hence the output.

💥Hashtags💥
#Infosys
#InfosysExam
#InfosysRecruitment
#InfosysPlacement
#InfosysCareer
#InfosysHiring
#InfosysJobs
#InfosysAptitudeTest
#InfosysInterview
#InfosysPreparation
#InfosysTraining
#InfosysTechInterview
#InfosysCodingTest
#InfosysOnlineTest
#InfosysCampusDrive
#InfosysWalkIn
#InfosysJobOpening
#InfosysFreshers
#InfosysJobAlert
#InfosysJobSeeker
#InfosysOffCampus
#InfosysHiringChallenge
#InfosysEligibility
#InfosysWrittenTest
#InfosysMockTest
#InfosysExamTips
#InfosysExamPreparation
#InfosysExamPattern
#InfosysExamSyllabus
#InfosysExamStrategy
#InfosysExam2024
#InfosysExamGuide
Рекомендации по теме
Комментарии
Автор

Hi bro, Infosys pre training me java handson ka important topics batao

saisagar
Автор

Bro Kitna MCQ and Code Ata Hai
Aur Code Kis Topic pe ata Hai Like Java Or DSA Or DBMS

kingslayer
Автор

Bhaiya abhi tak result ke regarding koi update mila he apko?

Duke.astaroth