So far I have a for loop that goes through a, then another for loop that checks with values of b, and then takes the highest values of c and places that into the new array
D = [0, 0, 0]
for i in A
highestToAdd = 0
for j in B
if B[j] < A[i]
if C[j] > highestToAdd
highestToAdd = C[j]
D[i] = highestToAdd
return D
input arrays:
A = [3, 1, 7]
B = [5, 0, 2]
C = [5, 3, 25]
output array is:
D = [25, 3, 25]
Here you can see we got 25 twice, and we had to loop through the entirety of b more than once, to find the highest value in c to find it.
As you can see I would be looping for every value of a with every value of b again and again (especially when the 3 array sizes increase), what direction should I take?
Edit - larger sample
A = [5, 2, 1, 9, 3, 1, 5, 4, 2, 2]
B = [8, 1, 7, 10, 6, 2, 5, 2, 4, 3]
C = [9, 5, 8, 4, 6, 10, 3, 9, 6, 8]
would result in
D = [10, 10, 5, 10, 10, 5, 10, 10, 10, 10]