FactSet Interview Question

Some two-pointer substring problem on Hackerrank