Pergunta de entrevista da empresa Google

Given an array of strings, write one function that will take that array and turn it into a singular string. Then, write another function that will take the output of that previous function, and return an array identical to the original array.

Resposta da entrevista

Sigiloso

10 de nov. de 2018

string Array2String(vectorV) { char sp = '$'; string s = ""; for (auto e : V) { s += e + sp; } return s; } vectorstring2Array(string s) { int st = 0, end = 0; vectorV; while ((end = s.find('$', st)) != -1) { V.push_back(s.substr(st, end - st)); st = end+1; } return V; } vectorVv = string2Array(Array2String(vector{"Hello", "there is", "my first", "dog", "eater done!"}));