Since you return an array you should build a new array as you go through the loop. You have three possible outcomes. The first is when no power of 10 is reached (either skip this value or add it to the new array, and the second case is if a power of 10 is encountered. From here on you do two things at each step, check the next value if an array, if it is not a multiple of 10, replace it with the current multiple of 10, otherwise store the new multiple of 10 and repeat. No one here is going to give you code for this. While this description may be a bit confusing, try to understand it and apply it. Some psudo code

Code:

declare current multiple
for
if (condition)
if (condition)
add multiple of 10 to array
end if
if (condition)
continue on or put value into new array
end if
end if
if (condition)
save current multiple of 10
add current multiple or continue
end if