Company: Autodesk_10april
Difficulty: medium
Construct 2-Character Strings Problem Description You are given an array `a` containing a list of strings. Your task is to construct an array of the same length where each element is a 2-character string formed by the first character of `a[i]` concatenated with the last character of `a[i+1]`. If there is no `a[i+1]`, cycle back to the beginning of the array. In other words, for the final element, consider the first character of `a[a.length - 1]` with the last character of `a[0]`. Return the resulting array of 2-character strings. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than `sum(a[i].length)` will fit within the execution time limit. Examples Example 1: Input: a = ["cat", "dog", "ferret", "scorpion"] Output: ["cg", "dt", "fn", "st"] Explanation: For `a[0]` ("cat"), take 'c'. For `a[1]` ("dog"), take 'g'. Result: "cg". For `a[1]` ("dog"), take 'd'. For `a[2]` ("ferret"), take 't'. Result: "dt". For `a[2]` ("ferret"),