Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
e567797
merge: added Problem 25 to Euler (#793)
byt3h3ad Oct 21, 2021
debc707
Auto-update DIRECTORY.md
Oct 21, 2021
278dc5c
merge: Add project-euler problem 12 (#767)
aayushborkar14 Oct 21, 2021
190ebb0
chore: use standard without fix
raklaptudirm Oct 22, 2021
71b48c8
fix: standard style problems
raklaptudirm Oct 22, 2021
b7f1a72
merge: added Problem 23 to Project Euler (#803)
byt3h3ad Oct 22, 2021
ffbfb20
Auto-update DIRECTORY.md
Oct 22, 2021
e83b570
merge: fixed some spellings (#773)
raghav-wd Oct 22, 2021
cd3974c
merge: Added Sum of GP (#807)
SpiderMath Oct 23, 2021
4ba2c32
Auto-update DIRECTORY.md
Oct 23, 2021
d5e309b
merge: Add binary to decimal test file and convert function to es6 mo…
ddhira123 Oct 23, 2021
d19108b
Auto-update DIRECTORY.md
Oct 23, 2021
32f1e33
merge: Added Hex to Binary conversion (#805)
ddhira123 Oct 24, 2021
e8d862c
merge: Added manhattan distance and euclidean distance for distance 2…
ddhira123 Oct 25, 2021
69a397c
merge: Added LucasSeries Implementation (#808)
SpiderMath Oct 25, 2021
32781c2
Auto-update DIRECTORY.md
Oct 25, 2021
4fb0809
merge: fixes: #774 - add test and fix MinPriorityQueue implementation…
pasagedev Oct 26, 2021
502aec2
merge: Added Aliquot Sum Implementation (#810)
SpiderMath Oct 26, 2021
3f00737
Auto-update DIRECTORY.md
Oct 26, 2021
7c2f19b
merge: Rename 2 filenames to follow PascalCase (#816)
SpiderMath Oct 26, 2021
4fa3c5e
Auto-update DIRECTORY.md
Oct 26, 2021
8a4f117
merge: add UnionFind.js plus tests (#814)
pschik Oct 26, 2021
4e18bbd
Auto-update DIRECTORY.md
Oct 26, 2021
54de6e5
merge: Fix pull request template (#818)
Bhargavishnu Oct 27, 2021
e4808a6
merge: Add MinHeap and test (#817)
tinatae Oct 27, 2021
970b4f2
Auto-update DIRECTORY.md
Oct 27, 2021
1cef191
merge: Made all tests follow file strcture convention already in-plac…
RenatoLopes771 Oct 28, 2021
820f8e9
merge: Create firstRelativeMaxPointInArray.js (#772)
jhonDoe15 Oct 28, 2021
00900f1
Auto-update DIRECTORY.md
Oct 28, 2021
9ad93c7
merge: Create findRelativeMaximumPointCount.js (#771)
jhonDoe15 Oct 28, 2021
82db978
Auto-update DIRECTORY.md
Oct 28, 2021
f8d4a26
chore: jest fall back
raklaptudirm Oct 28, 2021
59e9baf
feat: add codespell
raklaptudirm Oct 28, 2021
315db14
chore: fix spelling
raklaptudirm Oct 28, 2021
d16336a
chore: fix spelling
raklaptudirm Oct 28, 2021
b30f9f3
chore: fix spelling
raklaptudirm Oct 28, 2021
7722870
merge: Created composite Simpson's integration method. Tests included…
ggkogkou Oct 28, 2021
072523d
merge: Fix spellings (#821)
raklaptudirm Oct 28, 2021
1cd3b86
merge: Created midpoint integration numerical method (#822)
ggkogkou Oct 28, 2021
2203c1a
chore: use `UpperCamelCase`
raklaptudirm Oct 28, 2021
01a2e9a
chore: use `UpperCamelCase`
raklaptudirm Oct 28, 2021
d2883fe
chore: use `UpperCamelCase`
raklaptudirm Oct 28, 2021
9120085
chore: use `UpperCamelCase`
raklaptudirm Oct 28, 2021
3723322
fix: update file name
raklaptudirm Oct 28, 2021
09eebc4
merge: fix: optimize PrimeFactors (#823)
nella17 Oct 29, 2021
7c39839
merge: Add LinearSieve.js (#828)
nella17 Oct 31, 2021
f692da2
Auto-update DIRECTORY.md
Oct 31, 2021
2619ab6
merge: Added bisection method (#827)
ggkogkou Oct 31, 2021
12cf29e
fix: endlines in the CI file
Panquesito7 Nov 2, 2021
308b022
merge: Sliding window (#833)
Aditya1942 Nov 3, 2021
64920bf
merge: Removed ignored code files form codespell workflow. (#834)
raklaptudirm Nov 3, 2021
85b0571
chore: Strings: Credit Card Validation (#830)
Bhargavishnu Nov 4, 2021
65931be
merge: fixed argument data type (#835)
longvo04 Nov 8, 2021
c1c895b
chore: Add PowLogarithmic in Math (#836)
Yatin-kathuria Nov 19, 2021
f379475
merge: Add TribonacciNumber in dp (#839)
Yatin-kathuria Nov 20, 2021
93e57b0
merge: Add FibonacciNumber.js test case and update the decription of …
Yatin-kathuria Nov 20, 2021
02a4cee
merge: optamization,documantation,return Array[bool] => Array[primes …
Yatin-kathuria Nov 20, 2021
4e7a156
merge: add test case and description (#842)
Yatin-kathuria Nov 22, 2021
2ae00a9
merge: add description (#843)
Yatin-kathuria Nov 23, 2021
4aac366
merge: Refactor Code and Add test case (#845)
Yatin-kathuria Nov 25, 2021
8b1a4b9
merge: fix #844 (#846)
aditya1944 Nov 25, 2021
2fb0d48
merge: Add test cases, optamization of code, and Add description of f…
Yatin-kathuria Nov 26, 2021
de27089
merge: Add FindMin (#849)
Yatin-kathuria Nov 26, 2021
061218b
merge: Modify Graph bfs method (#847)
Yatin-kathuria Nov 26, 2021
c33b19a
merge: Graph (#850)
Yatin-kathuria Nov 27, 2021
51415f8
merge: Add test case (#851)
Yatin-kathuria Nov 27, 2021
cc34088
merge: Add Description and Optamization (#852)
Yatin-kathuria Nov 27, 2021
027c0d6
merge: Add test cases (#854)
Yatin-kathuria Nov 28, 2021
6f1edd1
merge: Add test Case for Palindrome Recursive (#855)
Yatin-kathuria Nov 28, 2021
bf681d1
merge: alphaNumericPlaindrome optamization (#857)
Yatin-kathuria Nov 29, 2021
c3b2bac
merge: fixes: #{} (#853)
itsmohitmkk Nov 30, 2021
961f21f
merge: Add test case and enacements (#858)
Yatin-kathuria Dec 1, 2021
6fb649e
merge: Add ValidateUrl in String (#856)
Yatin-kathuria Dec 2, 2021
62b151e
merge: Fixes: #860 (#861)
zaaath Dec 2, 2021
4c27e15
merge: Add lower (#863)
Yatin-kathuria Dec 4, 2021
43515a6
merge: Add Upper (#862)
Yatin-kathuria Dec 6, 2021
7560beb
merge: Add tests and docs for the Longest Common Subsequence algorith…
zaaath Dec 8, 2021
4d55b40
merge: Absolute value (#866)
Yatin-kathuria Dec 11, 2021
c30b897
merge: count Vowels (#864)
Yatin-kathuria Dec 11, 2021
f387ff3
chore: Remove duplicate `DigitSum` algorithm (#873)
raklaptudirm Dec 11, 2021
bbdb5cf
merge: Binary Convert (#865)
Yatin-kathuria Dec 14, 2021
3d2a48f
merge: Improve Mean method (#874)
Yatin-kathuria Dec 15, 2021
ef832f6
merge: add areaTriangleWithAllThreeSides method in Math/Area.js (#875)
Yatin-kathuria Dec 15, 2021
0aa5094
merge: add alphanumerical sort (#872)
RuSaG0 Dec 20, 2021
49fa7d1
merge: improve median (#869)
RuSaG0 Dec 20, 2021
7dd99c1
merge: chore(deps): bump node-fetch from 2.6.1 to 3.1.1 (#877)
dependabot[bot] Jan 23, 2022
31b06c9
merge: Let traverseLevel return early if node is null (#878)
Worldwidebrine Jan 24, 2022
c496925
merge: rename `SinglyLinkList` to `SinglyLinkedList` (#881)
maltejur Feb 14, 2022
833d05d
merge: binarySearch (#884)
AbmSourav Feb 16, 2022
6bd2ac6
merge: Decrease time period for marking an issue stale (#885)
raklaptudirm Feb 16, 2022
c9701e8
merge: Improving the coding standard for AvLTree Data Structure (#882)
rahulrajrd Feb 17, 2022
9911410
merge: Implement Add Two Numbers (Linked List) (#888)
ShakilAhmmed Feb 17, 2022
68ca0ce
merge: optimize the countVowels algo (#886)
fahimfaisaal Feb 17, 2022
29a3ab7
merge: Iterator and log methods added for linked lists (#891)
AbmSourav Feb 18, 2022
041918d
merge: Upgrade Lower function (#894)
fahimfaisaal Feb 19, 2022
dbc98d0
merge: Bubble Sort enhancements for nearly sorted or sorted array, ad…
aminhossain Feb 19, 2022
743b317
merge: Corrected JSdoc typo (#898)
Rudxain Feb 21, 2022
8bf29fe
merge: Optimize the space complexity of the fibonacci algo (#899)
fahimfaisaal Feb 22, 2022
be15d08
merge: replaced constructor function with es6 class syntax (#900)
mmestiyak Feb 23, 2022
0178efd
merge: Algorithm to calculate the Arithmetic Geometric Mean (#897)
Rudxain Feb 24, 2022
d466be9
merge: Upgrade `checkAnagram` function & Fixes (#902)
fahimfaisaal Feb 25, 2022
e8de031
merge: Improved pangram algorithm using regular expressions (#906)
fahimfaisaal Feb 28, 2022
ab06131
merge: Improved `Pow` function (#911)
fahimfaisaal Mar 2, 2022
378d4ab
merge: Upgraded `hexToBinary` function (#910)
fahimfaisaal Mar 2, 2022
eb748ae
merge: Fixed `wordOccurrence` algorithm (#909)
fahimfaisaal Mar 2, 2022
6656ece
merge: Improved `Memoize` function (#912)
fahimfaisaal Mar 2, 2022
cc55dab
merge: Updated `pull_request_template` (#913)
fahimfaisaal Mar 2, 2022
98c46b4
merge: Improved `IsOdd` function (#914)
fahimfaisaal Mar 4, 2022
00f5936
merge: Add alternative implementation for InsertionSort and relative …
HereBeAndre Mar 4, 2022
35ba618
merge: Added replace method to `Upper` (#916)
fahimfaisaal Mar 5, 2022
5198af8
merge: Run "style" and "test" scripts automatically when committing n…
akib22 Mar 9, 2022
4f6fe19
merge: resolve example mistake (#919)
fahimfaisaal Mar 10, 2022
da6c227
merge: refactor `isEven` function (#920)
fahimfaisaal Mar 11, 2022
7f479b8
merge: consistent list syntax in `CONTRIBUTING.md` (#921)
akib22 Mar 12, 2022
80cea08
merge: Add testcases of BinaryCountSetBits function (#922)
Ankush263 Mar 15, 2022
0924f1c
merge: Improved `abs` function (#923)
fahimfaisaal Mar 15, 2022
a545f76
merge: Add test case of SquareRoot function (#926)
Ankush263 Mar 15, 2022
1992425
merge: Add test cases to ArbitraryBase, DateToDay & DateDayDifference…
Ankush263 Mar 16, 2022
ffa4846
merge: Add FindMinIterator algorithm (#928)
trasherdk Mar 16, 2022
92a2f6d
merge: added @babel/eslint-parser (#931)
fahimfaisaal Mar 17, 2022
e33503f
merge: Add test case to DecimalToBinary,DecimalToOctal & OctToDecimal…
Ankush263 Mar 18, 2022
5302002
merge: Add test case to LowerCaseConversion (#934)
Ankush263 Mar 18, 2022
bb23382
merge: Add test case to RGBToHex & RailwayTimeConversion algorithm (#…
Ankush263 Mar 19, 2022
9f7ed56
merge: Remove duplicate helper functions in cache tests. (#933)
fahimfaisaal Mar 20, 2022
9d2a7f1
merge: Add test case to ConvexHullGraham Algorithm (#938)
Ankush263 Mar 21, 2022
ad68c63
merge: Added new clean `LFUCache` class (#939)
fahimfaisaal Mar 21, 2022
d246958
merge: Added explicit cache feature & optional parameter (#941)
fahimfaisaal Mar 22, 2022
9681688
merge: Add `CheckExceeding` function (#907)
fahimfaisaal Mar 22, 2022
ecf7cf9
merge: Add test case to countingSort algorithm (#943)
Ankush263 Mar 22, 2022
699146f
merge: Add test case to secondLargestElement Algorithm (#945)
Ankush263 Mar 23, 2022
233ec59
merge: Add Graph3 (add DFS in Iterative Way) (#944)
devycha Mar 24, 2022
532cf3e
merge: Add test case to FlashSort algorithm (#946)
Ankush263 Mar 24, 2022
73efc89
merge: Fix GnomeSort algorithm and Add test case to it (#948)
Ankush263 Mar 24, 2022
55da7a1
merge: Add test case to HeapSort Algorithm (#947)
Ankush263 Mar 24, 2022
81c771b
merge: Improved `LRUCache` (#953)
fahimfaisaal Mar 27, 2022
b85bf49
merge: Fixed a wrong sentence structure (#952)
utsav0 Mar 27, 2022
47c1c51
merge: Improved ciphers (#954)
fahimfaisaal Mar 27, 2022
d6a327a
merge: Add test case and fix the OddEvenSort Algorithm (#955)
Ankush263 Mar 27, 2022
5476021
chore(deps): bump minimist from 1.2.5 to 1.2.6 (#957)
dependabot[bot] Mar 28, 2022
1249dbe
merge: Round-trip testing for Atbash cipher (#958)
trasherdk Mar 28, 2022
b4fafb2
merge: added jest type for suggestions (#959)
fahimfaisaal Mar 28, 2022
3b9af46
merge: added `reduceRight` & `trim` method (#961)
fahimfaisaal Mar 28, 2022
27ae62e
merge: reduce upper & lower & add export default (#960)
fahimfaisaal Mar 28, 2022
7d57f7f
merge: cache repeated function calls (#962)
fahimfaisaal Mar 28, 2022
cdfa264
merge: Improved `CaesarsCipher` Algorithm (#963)
fahimfaisaal Mar 29, 2022
075d35f
merge: Improved `ROT13` function (#964)
fahimfaisaal Mar 29, 2022
c21ad2c
merge: Improved `xorCipher` (#965)
fahimfaisaal Mar 29, 2022
d47555b
merge: Add test case and fix HeapSort Algorithm (#969)
Ankush263 Mar 31, 2022
871a49f
merge: test case to radixSort Algorithm (#968)
Ankush263 Apr 1, 2022
6f33f99
merge: Add test case and fix pigeonHoleSort Algorithm (#967)
Ankush263 Apr 1, 2022
2be0fdc
merge: Decimal Expansion (#787)
lvlte Apr 2, 2022
42b9f64
merge: Update workflow organization and environments (#971)
raklaptudirm Apr 3, 2022
2169e17
merge: Add test case to shellSort algorithm (#975)
Ankush263 Apr 3, 2022
35035f7
merge: Add test case and fix TimSort algo (#977)
Ankush263 Apr 3, 2022
dfe200a
merge: Improving coding standard of singly linked list (#980)
rahulrajrd Apr 9, 2022
74857b7
merge: Improvement on singly circular linkedList (#981)
rahulrajrd Apr 10, 2022
48e3e8d
chore: use `stale` label to mark something as stale
raklaptudirm Apr 16, 2022
4098932
Change 1 week to 2 weeks for stale issues
Panquesito7 Apr 18, 2022
8fc5390
merge: FindLCM: Improve code readablility (#985)
CarlosZoft Apr 20, 2022
298ab33
merge: Add proper tests for binary search (#987)
CarlosZoft Apr 21, 2022
eb36e2d
merge: Format codebase with `standard.js` (#989)
CarlosZoft Apr 21, 2022
1e0dd1c
chore: add appgurueu to `CODEOWNERS`
raklaptudirm Apr 21, 2022
9513bcd
merge: WhileLoopFactorial: Optimize and add tests (#992)
merelymyself Apr 21, 2022
c81db62
merge: EuclidGCD: add tests (#994)
merelymyself Apr 22, 2022
7881cb5
Add Boyer-Moore string search algorithm (#990)
ayDavidGitHere Apr 23, 2022
5641b6f
Add Zeller's Congruence Algorithm in Math (#996)
merelymyself Apr 27, 2022
2e18fbb
merge: Add the Stooge Sort Algorithm (#998)
Madiena Apr 28, 2022
6d5e641
merge: tweak `DIRECTORY.md` generation (#999)
raklaptudirm Apr 28, 2022
01db0fb
Fix wiggle sort (#991)
BranAndSceolan Apr 28, 2022
e447b55
merge: Update directory workflow (#1000)
raklaptudirm Apr 28, 2022
2806253
merge: Upgrade max char (#983)
fahimfaisaal May 2, 2022
b81c339
merge: Improve pull request template (#1002)
appgurueu May 4, 2022
edd7076
merge: A better `README` (#1003)
raklaptudirm May 6, 2022
03d0b1e
merge: Update README.md (#1004)
ozayman May 6, 2022
e05b443
merge: Improved the complexity of dequeue O(n) to O(1) (#1005)
fahimfaisaal May 6, 2022
cbc669a
merge: Upgraded Algorithm of alpha numeric palindrome (#1006)
fahimfaisaal May 7, 2022
21a8511
merge: Find max recursion (#1010)
Exortions May 9, 2022
f736217
merge: Add test case to KeywordShiftedAlphabet algorithm (#1013)
Ankush263 May 12, 2022
c865654
Clean up phone number formatting (#1015)
fahimfaisaal May 16, 2022
4cd6fd4
merge: Add test case to Vigenere Cipher Algorithm (#1017)
Ankush263 May 17, 2022
360c447
merge: Add test case to HexToRGB algorithm (#1018)
Ankush263 May 17, 2022
d28ae8b
merge: Update test case for bubbleSort ( with code style is fixed) (#…
thanhphuonghdhh May 23, 2022
dc67506
merge: Add pronic number implementation (#1023)
itsAkshayDubey May 25, 2022
0357a23
merge: Add the Collatz Conjecture (#1022)
Exortions May 26, 2022
92a81a2
merge: Add Twin Primes algorithm (#1024)
Exortions May 27, 2022
9befd92
Add testcase to checkKebabCase (#1027)
Ankush263 May 30, 2022
07e77fa
merge: Add testcase to AlternativeStringArrange Algorithm (#1026)
Ankush263 May 30, 2022
162e90f
merge: Add test case to palindromeRearranging Algorithm (#1030)
Ankush263 May 31, 2022
d59213d
merge: Add test case to CheckPascalCase Algorithm (#1029)
Ankush263 May 31, 2022
0dccd28
merge: fix typo(change file name) (#1034)
Ankush263 Jun 2, 2022
dbffac2
merge: FindSecondLargestElement: Support negative numbers (#1036)
appgurueu Jun 3, 2022
61ee224
merge: Add test case to Find Second Largest Element Algorithm (#1037)
Ankush263 Jun 5, 2022
c105c4d
merge: Rename pigeonHoleSort.test.js to PigeonHoleSort.test.js (#1038)
Ankush263 Jun 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @raklaptudirm
* @raklaptudirm @appgurueu
32 changes: 14 additions & 18 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# Welcome to JavaScript community

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/) [know more](https://www.gitpod.io/docs/pull-requests/)

### Describe your change:

- [ ] Add an algorithm?
- [ ] Fix a bug or typo in an existing algorithm?
- [ ] Documentation change?

### **Describe your change:**

* [ ] Add an algorithm?
* [ ] Fix a bug or typo in an existing algorithm?
* [ ] Documentation change?

### Checklist:

### **Checklist:**
* [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Javascript/blob/master/CONTRIBUTING.md).
* [ ] This pull request is all my own work -- I have not plagiarized.
* [ ] I know that pull requests will not be merged if they fail the automated tests.
* [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
* [ ] All new JavaScript files are placed inside an existing directory.
* [ ] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not
* [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
* [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.
- [ ] I have read [CONTRIBUTING.md](https://github.com/TheAlgorithms/Javascript/blob/master/CONTRIBUTING.md).
- [ ] This pull request is all my own work -- I have not plagiarized.
- [ ] I know that pull requests will not be merged if they fail the automated tests.
- [ ] This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
- [ ] All new JavaScript files are placed inside an existing directory.
- [ ] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not
- [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
- [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.
8 changes: 4 additions & 4 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
# Number of days of inactivity before an issue becomes stale (2 weeks)
daysUntilStale: 14
# Number of days of inactivity before a stale issue is closed (a week)
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- bug
- help wanted
- OK to merge
# Label to use when marking an issue as stale
staleLabel: wontfix
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/Ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Continuous Integration

on:
push:
branches:
- master
pull_request:

jobs:
build:
name: Code style and tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16.x"
cache: npm

- name: 📦 Install dependencies
run: npm ci

- name: 🧪 Run tests
run: npm test

- name: 💄 Code style
run: npm run style

codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: codespell-project/actions-codespell@master
with:
# file types to ignore
skip: "*.json,*.yml,DIRECTORY.md"
ignore_words_list: "ba,esy,yse"
46 changes: 14 additions & 32 deletions .github/workflows/UpdateDirectory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,24 @@ import path from 'path'
import fs from 'fs'
import { globby } from 'globby'

const URL_BASE = 'https://github.com/TheAlgorithms/Javascript/blob/master'

function pathPrefix (i) {
if (i) {
const res = ' '.repeat(i)
return res + '*'
} else {
return '\n##'
}
const res = ' '.repeat(i)
return res + '*'
}

function printPath (oldPath, newPath, output) {
const oldParts = oldPath.split(path.sep)
const newParts = newPath.split(path.sep)

for (let i = 0; i < newParts.length; ++i) {
const newPart = newParts[i]
if (i + 1 > oldParts.length || oldParts[i] !== newPart) {
if (newPart) {
output.push(`${pathPrefix(i)} ${newPart.replace('_', ' ')}`)
output.push(`${pathPrefix(i)} **${newPart.replace('_', ' ')}**`)
}
}
}

return newPath
}

Expand All @@ -36,38 +32,23 @@ function pathsToMarkdown (filePaths) {
if (a.toLowerCase() > b.toLowerCase()) return 1
return 0
})

for (let filepath of filePaths) {
const file = filepath.split(path.sep)
let filename = ''
if (file.length === 1) {
filepath = ''
filename = file[0]
} else {
const total = file.length
filename = file[total - 1]
filepath = file.splice(0, total - 1).join(path.sep)
}
let filename = path.basename(filepath)
filepath = path.dirname(filepath)

if (filepath !== oldPath) {
oldPath = printPath(oldPath, filepath, output)
}
let indent = 0
for (let i = 0; i < filepath.length; ++i) {
if (filepath[i] === path.sep) {
++indent
}
}
if (filepath) {
++indent
}

let indent = filepath.split(path.sep).length

// prepare the markdown-esque prefix to the file's line
const prefix = pathPrefix(indent)

// remove extension from filename
const name = filename.split('.')[0]

// create URL to the actual file on github
const url = encodeURI([URL_BASE, filepath, filename].join('/'))
const name = path.basename(filename, ".js")
const url = path.join(filepath, filename)

output.push(`${prefix} [${name}](${url})`)
}
Expand All @@ -79,6 +60,7 @@ function pathsToMarkdown (filePaths) {
globby([
'**/*.js',
'!(node_modules|.github)/**/*',
"!**/test/**/*",
'!**/*.test.js',
'!**/*.manual-test.js',
'!babel.config.js'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# This GitHub Action updates the DIRECTORY.md file (if needed) when doing a git push
name: Update Directory

on: [push]
on:
push:
branches-ignore:
"master"

jobs:
updateDirectory:
Expand All @@ -19,9 +22,16 @@ jobs:
- name: 🗄️ Create Directory from JS files
run: node .github/workflows/UpdateDirectory.mjs

- name: 🤓 Commit & push new Directory (if needed)
- name: Configure Github Action
run: |
git config --global user.name github-actions
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
.github/workflows/commitAndPushDirectory.sh

- name: 🤓 Commit & push new Directory (if needed)
run: |
if [[ `git status --porcelain` ]]; then
git commit -am "Updated Documentation in README.md"
git push
else
echo "NO CHANGES DETECTED"
fi
22 changes: 0 additions & 22 deletions .github/workflows/ci.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/workflows/commitAndPushDirectory.sh

This file was deleted.

5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run style
npm run test
2 changes: 1 addition & 1 deletion Backtracking/AllCombinationsOfSizeK.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Problem: Given two numbers, n and k, make all unique combinations of k numbers from 1 to n and in sorted order

What is combinations?
- Combinations is selecting items froms a collections without considering order of selection
- Combinations is selecting items from a collections without considering order of selection

Example:
- We have an apple, a banana, and a jackfruit
Expand Down
26 changes: 26 additions & 0 deletions Bit-Manipulation/test/BinaryCountSetBits.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { BinaryCountSetBits } from '../BinaryCountSetBits'

test('check BinaryCountSetBits of 25 is 3', () => {
const res = BinaryCountSetBits(25)
expect(res).toBe(3)
})
test('check BinaryCountSetBits of 36 is 2', () => {
const res = BinaryCountSetBits(36)
expect(res).toBe(2)
})
test('check BinaryCountSetBits of 16 is 1', () => {
const res = BinaryCountSetBits(16)
expect(res).toBe(1)
})
test('check BinaryCountSetBits of 58 is 4', () => {
const res = BinaryCountSetBits(58)
expect(res).toBe(4)
})
test('check BinaryCountSetBits of 4294967295 is 32', () => {
const res = BinaryCountSetBits(4294967295)
expect(res).toBe(32)
})
test('check BinaryCountSetBits of 0 is 0', () => {
const res = BinaryCountSetBits(0)
expect(res).toBe(0)
})
Loading