2 ms·
LinkedList.prototype.reverse = function () { var next, head = null; while (this.head !== null) { next = this.head.next; this.head.ne
by zx2c4 14y ago
LinkedList.prototype.reverse = function () {
var next, head = null;
while (this.head !== null) {
next = this.head.next;
this.head.next = head;
head = this.head;
this.head = next;
}
this.head = head;
};