better loop detection
Intuition\n Describe your first thoughts on how to solve this problem. \nHaving made a previous attempt that took 600ms I realised that detecting loops against 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nHaving made a previous attempt that took 600ms I realised that detecting loops against the initial s2 start point wasn\'t enough, so maybe an array storing s1&s2 cycle numbers at s2 loop would enable detection of any loop?\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTook some thinking about but in the end storing s2 cycle number at the end of each s1 cycle and storing s1 cycle number at the first detected letter of each s2 cycle gives the right information, as long as one completes the s1 cycle one is in when one detects the s2 alignment loop. Math is explained in the code. Now takes 0ms (?). Could do with some tidying up since `e[]` is no longer required.\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n\xB2)$$ longest loop might take `s1.length` cycles of `s1.length` iterations to find\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(1)$$ constant space defined by max string length\n\n# Code\n```\nint getMaxRepetitions(char * s1, int n1, char * s2, int n2){\n    int a = 0, b = 0, c = 0, d = 0, f = -1;\n    int e[102], g[102], h[102]; for(int n = 0; n < 102; e[n++] = -1);\n    char s1r, s2r = s2[0];\n    while(c < n1)\n    {   if(!(s1r = s1[a++])) { h[c++] = d; a = 0;  if(!(f < 0)) goto earlycalc; continue; } // loop reading of s1\n        if(s2r == s1r) \n        {   if(b == 0) { if(e[a] == -1) { e[a] = d; g[a] = c; } else f = a; } \n            if(!(s2r = s2[++b])) { s2r = s2[(b = 0)]; d++; }\n        }\n    }\n    return (d / n2);\nearlycalc: ;\n//  counting continues after loop is found to end of current s1 cycle. \n//  s2 count is taken at the end of each s1 cycle\n\n    int s1cr = n1 - c;                       // s1 cycles remaining\n    int ls1c = c - g[f] - 1;                 // loop s1 cycles\n    int ls2c = h[c - 1] - h[g[f]];           // loop s2 cycles\n    int lr = s1cr / ls1c;                    // loops remaining\n    int s1cafl = s1cr % ls1c;                // s1 cycles after final loop\n    int s2cafl = h[g[f] + s1cafl] - h[g[f]]; // s2 cycles after final loop\n    int s2t = d + (lr * ls2c) + s2cafl;      // s2 total\n\n    //printf("%i, %i, %i, %i, %i, %i, %i, %i, %i, %i", a, b, c, d, e[0], e[1], e[2], e[a], f, g[a]);\n\n    return s2t / n2;\n}\n```
['String', 'C']