@windate3411/utils

1.0.0 • Public • Published

GitHub issues

Descripition

This package contains vary of functions I found myself used quite often while dealing with leetcode questions. Feel free to let me know what's on your mind :D

Install

npm install @windate3411/utils

Basic Usages

const utils = require("@windate3411/utils")

uitls.isPrime(4);
//false

uitls.countElement([1,4,3,2,2,5,7,6])
//{ '1': 1, '2': 2,
    '3': 1, '4': 1, 
    '5': 1, '6': 1, 
    '7': 1 }

uitls.permutaion([1,2,3])
//[ [ 1, 2, 3 ],
  [ 1, 3, 2 ],
  [ 2, 1, 3 ],
  [ 2, 3, 1 ],
  [ 3, 1, 2 ],
  [ 3, 2, 1 ] ]

Table of contents

function description params type return data type
isPrime(num) check if num is a prime number number boolean
countPrime(num) count how many prime numbers between 0 and num number number
countElement(arr) count elements in the array and return an object array object
combination(m,n) return the number of combinations given C(m,n) number number
fraction(num) return the fraction of num number number
permutaion(arr) return the permutaions of given arr array array
objectSort(obj) return sorted object alphabetically object object

Author

Danny Wang

Readme

Keywords

Package Sidebar

Install

npm i @windate3411/utils

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

3.74 kB

Total Files

3

Last publish

Collaborators

  • windate3411