Skip to content

Commit f9969d4

Browse files
authored
Merge pull request #694 from sir-gon/develop
Develop
2 parents 7a7cac2 + 2ae03db commit f9969d4

28 files changed

+11006
-334
lines changed

.github/workflows/eslint-code-scanning.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: Set up Node.js
4949
uses: actions/setup-node@v4
5050
with:
51-
node-version: 22.x
51+
node-version: 24.x
5252

5353
- name: Install ESLint
5454
run: |

.github/workflows/eslint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
strategy:
2828
matrix:
2929
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
30-
node-version: [18.x, 20.x, 22.x]
30+
node-version: [20.x, 22.x, 24.x]
3131
# See supported Node.js release schedule
3232
# at https://nodejs.org/en/about/releases/
3333
permissions:
@@ -43,7 +43,7 @@ jobs:
4343
- name: Set up Node.js
4444
uses: actions/setup-node@v4
4545
with:
46-
node-version: 22.x
46+
node-version: ${{ matrix.node-version }}
4747

4848
- name: Install ESLint
4949
run: |

.github/workflows/markdown-lint.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,14 @@ jobs:
1616
name: Markdown Lint
1717
runs-on: ubuntu-24.04
1818

19-
strategy:
20-
matrix:
21-
node-version: [22.x]
22-
# See supported Node.js release schedule
23-
# at https://nodejs.org/en/about/releases/
24-
2519
steps:
2620
- name: Checkout repository
2721
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2822

29-
- name: Set up Node.js ${{ matrix.node-version }}
23+
- name: Set up Node.js
3024
uses: actions/setup-node@v4
3125
with:
32-
node-version: ${{ matrix.node-version }}
26+
node-version: 24.x
3327

3428
- name: Install dependencies
3529
run: npm install -g markdownlint-cli

.github/workflows/node-coverage.js.yml renamed to .github/workflows/node-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Set up Node.js
2424
uses: actions/setup-node@v4
2525
with:
26-
node-version: 22.x
26+
node-version: 24.x
2727

2828
- name: Install dependencies
2929
run: npm ci --verbose

.github/workflows/node.js.yml renamed to .github/workflows/node-test.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ on: # yamllint disable-line rule:truthy
1111
workflow_dispatch:
1212

1313
jobs:
14-
build:
14+
test:
1515
name: NodeJS Jest CI Test
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
matrix:
1919
os: ["ubuntu-24.04", "macos-14", "windows-2022"]
20-
node-version: [18.x, 20.x, 22.x]
20+
node-version: [20.x, 22.x, 24.x]
2121
# See supported Node.js release schedule
2222
# at https://nodejs.org/en/about/releases/
2323

.github/workflows/prettier-json.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Prettier JSON Lint
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: ['main']
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: ['main']
10+
workflow_dispatch:
11+
12+
jobs:
13+
json-lint:
14+
name: 'Prettier JSON Lint'
15+
runs-on: ['ubuntu-24.04']
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 24.x
23+
24+
- name: Install Prettier
25+
run: |
26+
npm install -g prettier@3.5.3
27+
28+
- name: Prettier LINT / Style JSON
29+
run: >
30+
prettier --check ./src/**/*.json
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1+
---
12
singleQuote: true
23
quoteProps: preserve
34
useTabs: false
45
printWidth: 80
56
tabWidth: 2
67
trailingComma: none
7-
parser: typescript

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ WORKDIR ${WORKDIR}
1717

1818
RUN apk add --update --no-cache make nodejs npm \
1919
&& apk add --update --no-cache yamllint \
20-
&& npm install -g --ignore-scripts markdownlint-cli
20+
&& npm install -g --ignore-scripts markdownlint-cli \
21+
&& npm install -g --ignore-scripts prettier
2122

2223
# [!TIP] Use a bind-mount to "/app" to override following "copys"
2324
# for lint and test against "current" sources in this stage
@@ -39,7 +40,7 @@ COPY ./package-lock.json ${WORKDIR}/package-lock.json
3940
COPY ./Makefile ${WORKDIR}/
4041

4142
# code linting conf
42-
COPY ./.prettierrc ${WORKDIR}/
43+
COPY ./.prettierrc.yaml ${WORKDIR}/
4344
COPY ./.prettierignore ${WORKDIR}/
4445
COPY ./eslint.config.js ${WORKDIR}/
4546
COPY ./.babelrc ${WORKDIR}/

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,31 @@ dependencies:
6363
test -x ./node_modules || npm install --verbose
6464
@echo "################################################################################"
6565

66+
lint/json:
67+
prettier --check ./src/**/*.json
68+
6669
lint/markdown:
6770
markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.'
6871

6972
lint/yaml:
7073
yamllint --stric . && echo '✔ Your code looks good.'
7174

72-
lint: lint/markdown lint/yaml test/styling test/static
75+
lint: lint/markdown lint/yaml lint/json test/styling test/static
7376

7477
test/static: dependencies
7578
${NPM} run lint
7679

7780
test/styling: dependencies
7881
${NPM} run style:check
7982

80-
format: dependencies
83+
format/sources: dependencies
8184
${NPM} run style:format
8285

86+
format/json:
87+
prettier --write ./src/**/*.json
88+
89+
format: format/sources format/json
90+
8391
test: env dependencies
8492
${NPM} run jest:ci
8593

src/hackerrank/interview_preparation_kit/arrays/cruch_testcases_test.json

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,30 @@
33
"title": "Sample Test Case 0",
44
"n": 5,
55
"queries": [
6-
[
7-
1,
8-
2,
9-
100
10-
],
11-
[
12-
2,
13-
5,
14-
100
15-
],
16-
[
17-
3,
18-
4,
19-
100
20-
]
6+
[1, 2, 100],
7+
[2, 5, 100],
8+
[3, 4, 100]
219
],
2210
"expected": 200
2311
},
2412
{
2513
"title": "Sample Test Case 1",
2614
"n": 10,
2715
"queries": [
28-
[
29-
1,
30-
5,
31-
3
32-
],
33-
[
34-
4,
35-
8,
36-
7
37-
],
38-
[
39-
6,
40-
9,
41-
1
42-
]
16+
[1, 5, 3],
17+
[4, 8, 7],
18+
[6, 9, 1]
4319
],
4420
"expected": 10
4521
},
4622
{
4723
"title": "Sample Test Case 3",
4824
"n": 10,
4925
"queries": [
50-
[
51-
2,
52-
6,
53-
8
54-
],
55-
[
56-
3,
57-
5,
58-
7
59-
],
60-
[
61-
1,
62-
8,
63-
1
64-
],
65-
[
66-
5,
67-
9,
68-
15
69-
]
26+
[2, 6, 8],
27+
[3, 5, 7],
28+
[1, 8, 1],
29+
[5, 9, 15]
7030
],
7131
"expected": 31
7232
}
Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,56 @@
11
[
2-
{"title": "Own 0", "input": [1, 2, 3, 4, 5], "d_rotations": 1, "expected": [2, 3, 4, 5, 1]},
3-
{"title": "Own 1", "input": [2, 3, 4, 5, 1], "d_rotations": 1, "expected": [3, 4, 5, 1, 2]},
4-
{"title": "Own 2", "input": [3, 4, 5, 1, 2], "d_rotations": 1, "expected": [4, 5, 1, 2, 3]},
5-
{"title": "Own 3", "input": [4, 5, 1, 2, 3], "d_rotations": 1, "expected": [5, 1, 2, 3, 4]},
6-
{"title": "Own 4", "input": [5, 1, 2, 3, 4], "d_rotations": 1, "expected": [1, 2, 3, 4, 5]},
7-
{"title": "Sample Test case 0", "input": [1, 2, 3, 4, 5], "d_rotations": 4, "expected": [5, 1, 2, 3, 4]},
8-
{"title": "Sample Test case 1", "input": [41, 73, 89, 7, 10, 1, 59, 58, 84, 77, 77, 97, 58, 1, 86, 58, 26, 10, 86, 51], "d_rotations": 10, "expected": [77, 97, 58, 1, 86, 58, 26, 10, 86, 51, 41, 73, 89, 7, 10, 1, 59, 58, 84, 77]},
9-
{"title": "Sample Test case 2", "input": [33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60, 87, 97], "d_rotations": 13, "expected": [87, 97, 33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60]}
2+
{
3+
"title": "Own 0",
4+
"input": [1, 2, 3, 4, 5],
5+
"d_rotations": 1,
6+
"expected": [2, 3, 4, 5, 1]
7+
},
8+
{
9+
"title": "Own 1",
10+
"input": [2, 3, 4, 5, 1],
11+
"d_rotations": 1,
12+
"expected": [3, 4, 5, 1, 2]
13+
},
14+
{
15+
"title": "Own 2",
16+
"input": [3, 4, 5, 1, 2],
17+
"d_rotations": 1,
18+
"expected": [4, 5, 1, 2, 3]
19+
},
20+
{
21+
"title": "Own 3",
22+
"input": [4, 5, 1, 2, 3],
23+
"d_rotations": 1,
24+
"expected": [5, 1, 2, 3, 4]
25+
},
26+
{
27+
"title": "Own 4",
28+
"input": [5, 1, 2, 3, 4],
29+
"d_rotations": 1,
30+
"expected": [1, 2, 3, 4, 5]
31+
},
32+
{
33+
"title": "Sample Test case 0",
34+
"input": [1, 2, 3, 4, 5],
35+
"d_rotations": 4,
36+
"expected": [5, 1, 2, 3, 4]
37+
},
38+
{
39+
"title": "Sample Test case 1",
40+
"input": [
41+
41, 73, 89, 7, 10, 1, 59, 58, 84, 77, 77, 97, 58, 1, 86, 58, 26, 10, 86,
42+
51
43+
],
44+
"d_rotations": 10,
45+
"expected": [
46+
77, 97, 58, 1, 86, 58, 26, 10, 86, 51, 41, 73, 89, 7, 10, 1, 59, 58, 84,
47+
77
48+
]
49+
},
50+
{
51+
"title": "Sample Test case 2",
52+
"input": [33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60, 87, 97],
53+
"d_rotations": 13,
54+
"expected": [87, 97, 33, 47, 70, 37, 8, 53, 13, 93, 71, 72, 51, 100, 60]
55+
}
1056
]
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
{"title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3},
3-
{"title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3},
4-
{"title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3}
2+
{ "title": "Sample input 0", "input": [4, 3, 1, 2], "expected": 3 },
3+
{ "title": "Sample input 1", "input": [2, 3, 4, 1, 5], "expected": 3 },
4+
{ "title": "Sample input 2", "input": [1, 3, 5, 2, 4, 6, 7], "expected": 3 }
55
]
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
[
2-
{
3-
"title": "Test Case 0-0",
4-
"input": [2, 1, 5, 3, 4],
5-
"expected": "3"
6-
},
7-
{
8-
"title": "Test Case 0-1",
9-
"input": [2, 5, 1, 3, 4],
10-
"expected": "Too chaotic"
11-
},
12-
{
13-
"title": "Test Case 1-1",
14-
"input": [5, 1, 2, 3, 7, 8, 6, 4],
15-
"expected": "Too chaotic"
16-
},
17-
{
18-
"title": "Test Case 1-2",
19-
"input": [1, 2, 5, 3, 7, 8, 6, 4],
20-
"expected": "7"
21-
},
22-
{
23-
"title": "Test Case 2",
24-
"input": [1, 2, 5, 3, 4, 7, 8, 6],
25-
"expected": "4"
26-
}
27-
]
2+
{
3+
"title": "Test Case 0-0",
4+
"input": [2, 1, 5, 3, 4],
5+
"expected": "3"
6+
},
7+
{
8+
"title": "Test Case 0-1",
9+
"input": [2, 5, 1, 3, 4],
10+
"expected": "Too chaotic"
11+
},
12+
{
13+
"title": "Test Case 1-1",
14+
"input": [5, 1, 2, 3, 7, 8, 6, 4],
15+
"expected": "Too chaotic"
16+
},
17+
{
18+
"title": "Test Case 1-2",
19+
"input": [1, 2, 5, 3, 7, 8, 6, 4],
20+
"expected": "7"
21+
},
22+
{
23+
"title": "Test Case 2",
24+
"input": [1, 2, 5, 3, 4, 7, 8, 6],
25+
"expected": "4"
26+
}
27+
]

src/hackerrank/interview_preparation_kit/dictionaries_and_hashmaps/count_triplets_1.big.testcases.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
[
22
{
33
"title": "Sample Test Case 2",
4-
"input": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
5-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
4+
"input": [
5+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
6+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
7+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
8+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
9+
],
910
"r": 1,
1011
"expected": 161700
1112
}

0 commit comments

Comments
 (0)