C++ Third question, programming help, please provide code solution
Files solution.cpp x task3 // you can use includes, for example: There is a list A made of N strings, each of length 2. Two strings can be connected // #include
ether if the letter ending the first string is the same as the letter beginning the solution.cpp test-input.txt // you can write to stdout for debugging purposes, e.g. second string. For example, the two strings "ab" and "bc" can be connected, as "ab" // cout &A) { // Implement your solution here same as the first letter of the next string, e.g. "ab"-"ba"-"ac"-"cb". For every K from 0 to N-1, check if all the strings A[O], ..., A[K] can be connected together. Strings can be reordered, but must not be reversed. Write a function: string solution(vector &A); that, given an array A consisting of N strings, each of length 2, returns a string of length N. The K-th character of the string should be '1' if strings A[0], ..., A[K] can be connected into a single string, or '0' otherwise. Examples: 1. For A = ['he", "II", "lo", "el"], the function should return "1001": ['he ] is already a single string - 1 ['he , "Il"] cannot be connected - 0 . ['he , "Il", "lo"] cannot be connected - 0 ['he , "Il", "lo", "el"] can be connected into "he"-"el"-"Il"-"lo" - 1 To leave editor use Ctrl + Shift + M Language Version: 2. For A = ["ab", "ba", "bq"], the function should return "111". Strings can be connected Test Output into a single string for every K = 0, 1 and 2. Note that ["ab", "ba"] can be connected into either "ab"-"ba" or "ba"-"ab". 3. For A = ['ee", "ea", "eg"], the function should return "110". Write an efficient algorithm for the following assumptions: . N is an integer within the range [1..100,000]; each string in A has length 2 and consists only of lowercase letters (a-z). Copyright 2009-2023 by Codility Limited, All Rights Reserved. Unauthorized copying, publication or