Goldman Sachs interview question

Dp on strings and binary tree