Group Group Group Group Group Group Group Group Group

LinkedList Challenge Solution 3

extension LinkedList {

  mutating func reverse() {

    // 1
    let tmpList = LinkedList<Value>()
    for value in self {
      tmpList.push(value)
    }

    // 2
    head = tmpList.head
  }
}

For the easy way, the let tmpList should be a var right? cause we need to push(value)

I believe this linked list is defined as a reference type so you can use let and still call mutating methods. If you define LinkedList as a value type var would be required here.