Incorrect test, answer, and code for online coding test prep (scramble string)

This question asks for the code to take in a string, and an array of numbers (same length as the string), and to arrange the string according to the order of the indices on the array. However, the second test is actually an incorrect answer, and the code that is given as an example answer, produces the wrong answer (although it passes the test because the test is actually not testing for the correct answer).

the string is "“markov”, and the array is [5, 3, 1, 4, 2, 0]. The provided answer/test claims the solution should be “vkaorm”, but it should actually be “vroakm” (just look at the string at index 1. That is the “a”, and the array at index 1 is the number 3, so the a should be indexed art 3 (so it should be the 4th letter), but in the answer, it is the 3rd letter. You can repeat this for index 2, 3, and 4, and you will find they are all wrong.

Here is my solution, which is correct:
def scramble_string(string, positions)
new_array = []
i = 0
while i < positions.length
new_array.push(0)
i += 1
end
i = 0
while i < positions.length
new_array.insert(positions[i], string[i])
new_array.delete_at(positions[i] +1)
i += 1
end
new_string = new_array.join("")
puts new_string
return new_string
end

And here is the example answer, which is incorrect:

def scramble_string(string, positions)
result = “”

i = 0
while i < positions.length
result = result + string[positions[i]]
i += 1
end

return result
end

Here is a screenshot of the suggested answer code