Pergunta de entrevista da empresa Pocket Gems

How to find a sub-string in a string? How to convert a ternary expression into a binary tree structure?