@imran001/arraytolinkedlist
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @imran001/arraytolinkedlist

      Weekly Downloads

      0

      Version

      1.0.2

      License

      ISC

      Unpacked Size

      14.5 kB

      Total Files

      4

      Last publish

      Collaborators

      • imran001