Skip to content

Commit 4d7149c

Browse files
authored
Merge branch 'TheAlgorithms:master' into master
2 parents 0830570 + 60443c7 commit 4d7149c

File tree

488 files changed

+10933
-17728
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

488 files changed

+10933
-17728
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Bug report
2+
description: 'Create a report to help us improve'
3+
title: '[BUG]: '
4+
labels: ['bug']
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: '### Before you open an issue, please verify if a similar one already exists or has been closed before. More details about the process of contributing can be found in [CONTRIBUTING.md](https://github.com/TheAlgorithms/JavaScript/blob/master/CONTRIBUTING.md).'
9+
- type: textarea
10+
id: description
11+
attributes:
12+
label: Description
13+
description: Explain what the problem is.
14+
validations:
15+
required: true
16+
- type: textarea
17+
id: expectedbhv
18+
attributes:
19+
label: Expected Behavior
20+
description: Describe what was the expected behavior.
21+
validations:
22+
required: true
23+
- type: textarea
24+
id: actualbhv
25+
attributes:
26+
label: Actual Behavior
27+
description: Describe what actually happens.
28+
validations:
29+
required: true
30+
- type: textarea
31+
id: steps
32+
attributes:
33+
label: Steps to reproduce (if applicable)
34+
description: List steps to reproduce the behavior.
35+
placeholder: |
36+
1.
37+
2.
38+
3.
39+
4.
40+
validations:
41+
required: false
42+
- type: textarea
43+
id: extra_information
44+
attributes:
45+
label: Additional information
46+
description: Is there anything else we should know about this bug report?
47+
validations:
48+
required: false

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discord community
4+
url: https://the-algorithms.com/discord/
5+
about: Have any questions or found any bugs? Contact us via our Discord community.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Feature request
2+
description: 'Suggest features, propose improvements, discuss new ideas'
3+
title: '[FEATURE]: '
4+
labels: ['enhancement']
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
## This issue template is not for requesting new algorithms. For new algorithms, PRs should be opened directly.
10+
## Make sure your issue isn't a duplicate and you follow our [contributing guidelines](https://github.com/TheAlgorithms/JavaScript/blob/master/CONTRIBUTING.md)
11+
- type: textarea
12+
id: description
13+
attributes:
14+
label: Motivation
15+
description: Describe what is the motivation behind this feature.
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: examples
20+
attributes:
21+
label: Examples
22+
description: If possible, provide examples of how this feature can be used.
23+
validations:
24+
required: false
25+
- type: textarea
26+
id: workarounds
27+
attributes:
28+
label: Possible workarounds
29+
description: If possible, describes possible workarounds to this feature.
30+
validations:
31+
required: false
32+
- type: textarea
33+
id: extra_information
34+
attributes:
35+
label: Additional information
36+
description: Is there anything else we should know about this feature request?
37+
validations:
38+
required: false

.github/ISSUE_TEMPLATE/other.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Other issue
2+
description: Use this for any other issues. Do NOT create blank issues
3+
title: "[OTHER]: "
4+
labels: ["awaiting triage"]
5+
body:
6+
- type: textarea
7+
id: description
8+
attributes:
9+
label: What would you like to share?
10+
description: Provide a clear and concise explanation of your issue.
11+
validations:
12+
required: true
13+
- type: textarea
14+
id: extrainfo
15+
attributes:
16+
label: Additional information
17+
description: Is there anything else we should know about this issue?
18+
validations:
19+
required: false

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
- [ ] All new JavaScript files are placed inside an existing directory.
1616
- [ ] All filenames should use the UpperCamelCase (PascalCase) style. There should be no spaces in filenames.
1717
**Example:**`UserProfile.js` is allowed but `userprofile.js`,`Userprofile.js`,`user-Profile.js`,`userProfile.js` are not
18-
- [ ] All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
18+
- [ ] All new algorithms have a URL in their comments that points to Wikipedia or another similar explanation.
1919
- [ ] If this pull request resolves one or more open issues then the commit message contains `Fixes: #{$ISSUE_NO}`.

.github/workflows/Ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v3
15+
1516
- uses: actions/setup-node@v3
1617
with:
17-
node-version: 16
18+
node-version: 20
1819
cache: npm
1920

2021
- name: 📦 Install dependencies
2122
run: npm ci
2223

23-
- name: 🧪 Run tests
24-
run: npm test
24+
- name: 🧪 Run all tests
25+
run: npm run test
2526

2627
- name: 💄 Code style
2728
run: npm run style

.github/workflows/UpdateDirectory.mjs renamed to .github/workflows/UpdateDirectory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ globby([
6363
"!**/test/**/*",
6464
'!**/*.test.js',
6565
'!**/*.manual-test.js',
66-
'!babel.config.js'
66+
'!vitest.config.ts'
6767
])
6868
// create markdown content
6969
.then(pathsToMarkdown)

.github/workflows/UpdateDirectory.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
14+
1415
- uses: actions/setup-node@v3
1516
with:
16-
node-version: 16
17+
node-version: 20
1718
cache: npm
1819

1920
- name: 📦 Install dependencies
2021
run: npm ci
2122

2223
- name: 🗄️ Create Directory from JS files
23-
run: node .github/workflows/UpdateDirectory.mjs
24+
run: node .github/workflows/UpdateDirectory.js
2425

2526
- name: Configure Github Action
2627
run: |

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.github
2+
DIRECTORY.md

Backtracking/AllCombinationsOfSizeK.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Problem: Given two numbers, n and k, make all unique combinations of k numbers from 1 to n and in sorted order
33
44
What is combinations?
5-
- Combinations is selecting items from a collections without considering order of selection
5+
- Combinations is selecting items from a collections without considering the order of selection
66
77
Example:
88
- We have an apple, a banana, and a jackfruit
@@ -22,14 +22,14 @@
2222
*/
2323

2424
class Combinations {
25-
constructor (n, k) {
25+
constructor(n, k) {
2626
this.n = n
2727
this.k = k
2828
this.current = [] // will be used for storing current combination
2929
this.combinations = []
3030
}
3131

32-
findCombinations (high = this.n, total = this.k, low = 1) {
32+
findCombinations(high = this.n, total = this.k, low = 1) {
3333
if (total === 0) {
3434
this.combinations.push([...this.current])
3535
return this.combinations

0 commit comments

Comments
 (0)