Exercise: simple-linked-list
Problem: in the last test test_into_vector
code like this is executed:
let mut v = Vec::new();
let mut s = SimpleLinkedList::new();
for i in 1..4 {
v.push(i);
s.push(i);
}
However, because push
appends to the back for vectors, but to the front for simply linked lists, this creates the vector v = [1, 2, 3]
and the list s = [3, 2, 1]
. This causes the test to fail with correct solutions.