Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started