1.0.2 • Published 2 years ago

@imran001/arraytolinkedlist v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

About

This is a simple utility to convert an array to a linked list and vice versa.

Usage

import {
  arrayToLinkedList,
  linkedListToArray,
} from "@imran001/arraytolinkedlist";

const arr = [1, 2, 3, 4, 5];
const head = arrayToLinkedList(arr);
const result = linkedListToArray(head);

console.log(head); // Output: ListNode { val: 1, next: ListNode { val: 2, next: ListNode { val: 3, next: ListNode { val: 4, next: ListNode { val: 5, next: null } } } } }

console.log(result); // Output: [ 1, 2, 3, 4, 5 ]

Hire Me

Want to work with a kickass frontend dev?

Email me at ikhan77727@gmail.com. LinkedIn: https://www.linkedin.com/in/imrankhan001/

P.S: I excel in Remote Work Only