Turing interview question

2 DSA question about strings.