[KarpRabin] fixes to the algorithm

No more recursion now, but this is still slow.
2 jobs for 500-dev-limit-on-text-length-too-small-fix in 0 seconds (queued for 62 minutes and 8 seconds)
Status Job ID Name Coverage
  Test
failed #6112
deps

failed #6113
test

 
Name Stage Failure
failed
test Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job trace
failed
deps Test There has been a timeout failure or the job got stuck. Check your timeout limits or try again
No job trace