Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
93
var assert = require('assert');
function swapEveryTwo(head) {
// Fill in this method
return head;
}
function Node(val) {
this.val = val;
this.next = null;
}
function LinkedListNode(val) {
this.val = val;
this.next = null;
}
var list1 = new LinkedListNode(3);
var nodes1 = [4, 5, 6, 7, 8, 9, 10];
createNodes(list1, nodes1);
var list2 = new LinkedListNode(1);
var nodes2 = [2, 3, 4, 5, 6, 7, 8];
createNodes(list2, nodes2);
function createNodes(head, nodes) {
for (let i = 0; i < nodes.length; i++) {
OUTPUT
Results will appear here.