Find the best code for repeating elements in two arrays