Roche Interview Question

permutation of string, SQL question and another string problem