- Notifications
You must be signed in to change notification settings - Fork2
JS library to calculate and list permutation and combination. No dependencies
License
NotificationsYou must be signed in to change notification settings
kota-yata/Percom
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
npm package listing and calculating combination and permutation
$ npm i percom
importpercomfrom"percom";percom.com(array,num);//array => Target array (対象の配列)//num => Number of elements in a combination (組み合わせの数)
constarray=["A","B","C"];constresult1=percom.com(array,2);//result1 = [ [ "A", "B" ], [ "A, "C ], [ "B", "C" ] ]constresult2=percom.com(array,1);//result2 = [ [ "A" ], [ "B" ], [ "C" ] ]
percom.countCom(n,r);//n => Number of elements in an array (要素数)//r => Number of elements in a combination (選ぶ要素の数)
percom.countCom(8,3);// => 56
percom.per(array,num);//array => Target array (対象の配列)//num => Number of elements in a permutation (一つ一つの順列の要素数)
constarray=["A","B","C"];constresult1=percom.per(array,2);//result1 = [ [ 'A', 'B' ], [ 'A', 'C' ], [ 'B', 'A' ], [ 'B', 'C' ], [ 'C', 'A' ], [ 'C', 'B' ] ]constresult2=percom.per(array,1);//result2 = [ [ "A" ], [ "B" ], [ "C" ] ]
percom.countPer(n,r);//n => Number of elements in an array (要素数)//r => Number of elements in a permutation (一つ一つの順列の要素数)
percom.countPer(8,3);// => 336
percom is underMIT license
yarninstall// before create PRyarnmocha
Since lint-staged and husky are set up, your code will be formatted before commit.
Kota Yatagai (https://kota_yata.com)
About
JS library to calculate and list permutation and combination. No dependencies
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.