@imran001/arraytolinkedlist
v1.0.2
Published
A simple library to convert an array to a linked list and vice versa.
Downloads
1
Maintainers
Readme
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 [email protected]. LinkedIn: https://www.linkedin.com/in/imrankhan001/
P.S: I excel in Remote Work Only