Skip to content

Commit 5d0615b

Browse files
committed
Initial commit
0 parents  commit 5d0615b

16 files changed

+16544
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-react"
5+
]
6+
}

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist,
2+
*/__tests__/*

.eslintrc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
2+
{
3+
"rules": {
4+
"no-const-assign": 2,
5+
"object-curly-spacing": [
6+
2,
7+
"always"
8+
],
9+
"quotes": [
10+
2,
11+
"single"
12+
],
13+
"spaced-comment": 2,
14+
"space-before-blocks": 2,
15+
"no-plusplus": 2,
16+
"strict": 0,
17+
"no-console": 0,
18+
"no-var": 2,
19+
"indent": [
20+
2,
21+
4
22+
],
23+
"linebreak-style": [
24+
2,
25+
"unix"
26+
],
27+
"semi": [
28+
2,
29+
"always"
30+
]
31+
},
32+
"env": {
33+
"es6": true,
34+
"browser": true,
35+
"node": true,
36+
"mocha": true
37+
},
38+
"extends": "airbnb",
39+
"parser": "babel-eslint",
40+
"parserOptions": {
41+
"sourceType": "module",
42+
"allowImportExportEverywhere": false,
43+
"codeFrame": false
44+
},
45+
"plugins": [
46+
"react"
47+
]
48+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
build/*
2+
.idea/*
3+
node_modules/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Deepak Grover
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Algorithms Practice
2+
3+
Each problem directory includes:
4+
- Problem description with the link to original problem ( LeetCode, HackerRank, CodeWars... )
5+
- One ore more working solution to the problem
6+
- Unit test file
7+
8+
There might still be some personal comments added for my learning purposes.
9+
10+
## Data Structures
11+
12+
### Array
13+
14+
- [Fibonacci sequence](https://github.com/edignot/algorithms/tree/master/src/fibonacci-sequence)
15+
16+
```
17+
const getFibonacciEl = (i) => {
18+
const fibonacciArr = [1, 1]
19+
for (let x = 1; x < i; x++) {
20+
const sum =
21+
fibonacciArr[fibonacciArr.length - 1] +
22+
fibonacciArr[fibonacciArr.length - 2];
23+
fibonacciArr.push(sum);
24+
}
25+
return fibonacciArr[i];
26+
}
27+
28+
...
29+
30+
describe("Fibonacci sequence", () => {
31+
test("2nd element of fibonacci sequence", () => {
32+
expect(getFibonacciEl(2)).toBe(2)
33+
})
34+
test("7th element of fibonacci sequence", () => {
35+
expect(getFibonacciEl(7)).toBe(21)
36+
})
37+
test("12th element of fibonacci sequence", () => {
38+
expect(getFibonacciEl(12)).toBe(233)
39+
})
40+
})
41+
```
42+
43+
## Usage
44+
- Clone this repo
45+
- Run npm install to get dependencies
46+
- Run npm test to run testing files
47+
48+
## Contributors
49+
[Edita Ignot](https://github.com/edignot) | [MY COMMITS](https://github.com/edignot/algorithms/commits/master?author=edignot&branch=master)

debug.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
</head>
7+
<body>
8+
<script type="text/javascript" src="build/dist/bundle.js"></script>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)