Google Interview Question

One string problem and one backtracking problem