Frage im Vorstellungsgespräch bei Amazon

Algorithm for string sequence and the big o notation of the same