Binary Search
\n\t\tif set(s2)-set(s1)!=set():\n            return 0\n\t\t\n\t\t@cache\n        def f(i,n):   # starting from the ith position of s1, how many extra s1 we nee
\n\t\tif set(s2)-set(s1)!=set():\n            return 0\n\t\t\n\t\t@cache\n        def f(i,n):   # starting from the ith position of s1, how many extra s1 we need to cover n times of s2\n            if n>1:\n                ct1,i=f(i,n//2)\n                ct2,i=f(i,n//2+n%2)\n                return ct1+ct2,i \n\n            k,n=i==0,len(s1)\n            for j in s2:\n                while s1[i%n]!=j: i+=1  \n                i+=1\n            return (i-1)//n+k, i%n        \n    \n\n        l,h=0,100*n1*n2\n        while l<h:\n            mid=(l+h+1)//2            \n            if f(0,mid)[0]>n1: \n\t\t\t      h=mid-1\n            else:   \n\t\t\t      l=mid\n        \n        return l//n2
['Python']