The challenge is simple: given an input list
a and another list
a until it is longer than
As an example, call the repeated list
ra. Then the following condition must hold true:
len(b) < len(ra) <= len(b) + len(a). That is,
a must not be repeated more than is required.
Sample Python Implementation
def repeat(a, b): ra = a.copy() while len(b) >= len(ra): ra += a return ra
[1,2,3], [2,4] -> [1,2,3] [1,2,3], [2,3,4] -> [1,2,3,1,2,3] [1,2,3], [18,26,43,86] -> [1,2,3,1,2,3] [2,3,5], [1,2,3,4,5,6,7] -> [2,3,5,2,3,5,2,3,5] [1,123], [1,12,123,1234] -> [1,123,1,123,1,123]
This is code-golf, shortest answer in bytes wins. Have fun!