The purpose of this repository is to backup my solutions to the challenges I've solved in HackerRank.
Clone the repository:
git clone https://github.com/iramirezc-learning/my-hacker-rank-solutions.git
Install the dependencies:
cd my-hacker-rank-solutions
npm install
Run the tests:
npm run test
Run the challenge
script with the new path for the challenge.
Syntax
./scripts/challenge <new-path>
Example
Note: Change new-challenge
with the actual name of the problem.
$ ./scripts/challenge src/problems/new-challenge
# Created 'src/problems/new-challenge'
# Created 'src/problems/new-challenge/README.md'
# Created 'src/problems/new-challenge/new-challenge.js'
# Created 'src/problems/new-challenge/index.js'
# Created 'src/problems/new-challenge/specs'
# Created 'src/problems/new-challenge/specs/new-challenge.spec.js'
# Created 'src/problems/new-challenge/specs/input'
# Created 'src/problems/new-challenge/specs/output'
Finally, add the test cases files to the input
and output
directories. Note: Make sure to use the same name for each test case:
Example of the file tree created:
.
ββ src
β ββ problems
β β ββ new-challenge
β β β ββ specs
β β β β ββ input
β β β β β ββ 00.txt # add input test case file
β β β β ββ output
β β β β β ββ 00.txt # add output test case file matching input file name
β β β β ββ new-challenge.spec.js
β β β ββ index.js
β β β ββ new-challenge.js
β β β ββ README.md