Apollo.io interview question

Two programming questions, one is about strings and other is about binary search trees