Skip to content

Instantly share code, notes, and snippets.

@prmichaelsen
Created August 13, 2019 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prmichaelsen/4fe27caa735b545a597dce74eb27abc6 to your computer and use it in GitHub Desktop.
Save prmichaelsen/4fe27caa735b545a597dce74eb27abc6 to your computer and use it in GitHub Desktop.
let prev = null;
let reverse = null;
let it = head;
while (it !== null) {
prev = it;
it = it.next;
let temp = {
val: prev.val,
next: reverse,
};
reverse = temp;
}
return reverse;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment