Solve substring and worker assignment | Lyft Coding Question