Question: ar You are given an array of strings arr Your task is to construct a string from the words in starting with the oth character

 ar You are given an array of strings arr Your task

ar You are given an array of strings arr Your task is to construct a string from the words in starting with the oth character from each word (in the order they appear in arr ), followed by the 1st character, then the 2nd character, etc. If one of the words doesn't have an ith character, skip that word. Return the resulting string. Example = For arr ["Daisy", "Rose", "Hyacinth", "Poppy"] , the output should be solution (arr) = "DRHPaoyoisapsecpyiynth" . First, we append all oth characters and obtain string "DRHP" Then we append all ist characters and obtain string "DRHPaoyo" ; Then we append all 2nd characters and obtain string "DRHPaoyoisap" ; Then we append all 3rd characters and obtain string "DRHPaoyoisapaecp" ; Then we append all 4th characters and obtain string "DRHPaoyoisapaecpyiy" ; . Finally, only letters in the arr[2] are left, so we append the rest characters and get "DRHP aoyoisapaecpyiynth

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!