Apollo.io Interview Question

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