39.13% faster
\n\n# Code\n\nclass Record{\n    int count;\n    int nextIndex;\n\n    public Record(int count, int nextIndex){\n        this.count = count;\n        this.nextI
\n\n# Code\n```\nclass Record{\n    int count;\n    int nextIndex;\n\n    public Record(int count, int nextIndex){\n        this.count = count;\n        this.nextIndex = nextIndex;\n    }\n}\n\nclass Solution {\n    public int getMaxRepetitions(String s1, int n1, String s2, int n2) {\n        \n        List<Record> records = new ArrayList();\n\n        this.load(s1, s2, records);\n\n        int index = 0, match = 0;\n\n        while(n1>0){\n            match+=records.get(index).count;\n            index = records.get(index).nextIndex;\n            n1--;\n        }\n\n        return match/n2;\n\n    }\n\n    void load(String s1, String s2, List<Record> records){\n\n        for(int i=0; i<s2.length(); i++){\n            int nextIndex = i;\n            int count = 0;\n\n            for(int j=0; j<s1.length(); j++){\n\n                if(s2.charAt(nextIndex)==s1.charAt(j)) nextIndex++;\n\n                if(nextIndex==s2.length()){\n                    count++;\n                    nextIndex = 0;\n                }\n\n            }\n            records.add(new Record(count, nextIndex));\n        }\n\n\n\n    }\n\n\n\n}\n```
['Java']