-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f49ac48
commit 49b319f
Showing
185 changed files
with
3,639 additions
and
3,234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"semi": false, | ||
"semi": true, | ||
"printWidth": 80 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
language: | ||
node_js: | ||
- "8" | ||
- '8' | ||
install: | ||
- npm install | ||
- npm install -g codecov | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,33 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Program", | ||
"program": "${relativeFile}", | ||
"request": "launch", | ||
"skipFiles": [ | ||
"<node_internals>/**" | ||
], | ||
"type": "pwa-node" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Jest All", | ||
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | ||
"args": ["--runInBand"], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Jest Current File", | ||
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | ||
"args": ["${relativeFile}"], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
} | ||
|
||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Program", | ||
"program": "${relativeFile}", | ||
"request": "launch", | ||
"skipFiles": ["<node_internals>/**"], | ||
"type": "pwa-node" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Jest All", | ||
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | ||
"args": ["--runInBand"], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Jest Current File", | ||
"program": "${workspaceFolder}/node_modules/jest/bin/jest", | ||
"args": ["${relativeFile}"], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
"env": { | ||
"test": { presets: [ "@babel/preset-env" ] } | ||
} | ||
}; | ||
env: { | ||
test: {presets: ['@babel/preset-env']}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = test => test.replace(/\.tap\.js$/, '.js') | ||
module.exports = (test) => test.replace(/\.tap\.js$/, '.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# ⚗️ Fizz-Buzz | ||
|
||
The "Fizz-Buzz test" is an interview question designed to help filter out the 99.5% of programming job candidates who can't seem to program their way out of a wet paper bag. | ||
The "Fizz-Buzz test" is an interview question designed to help filter out the 99.5% of programming job candidates who can't seem to program their way out of a wet paper bag. | ||
|
||
The text of the programming assignment is as follows: | ||
|
||
> Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”. | ||
[check the code](fizzbuzz.js) and the [test](__tests__/fizzbuzz.test.js) | ||
[check the code](fizzbuzz.js) and the [test](__tests__/fizzbuzz.test.js) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
function riverSizes(matrix) { | ||
const sizes = []; | ||
const visited = matrix.map((row) => row.map(() => false)); | ||
for (let i = 0; i < matrix.length; i++) { | ||
for (let j = 0; j < matrix[i].length; j++) { | ||
if (visited[i][j]) continue; | ||
traverseNode(i, j, matrix, visited, sizes); | ||
} | ||
} | ||
return sizes; | ||
} | ||
|
||
function traverseNode(i, j, matrix, visited, sizes) { | ||
let currentRiverSize = 0; | ||
const nodesToExplore = [[i, j]]; | ||
while (nodesToExplore.length) { | ||
const currentNode = nodesToExplore.pop(); | ||
i = currentNode[0]; | ||
j = currentNode[1]; | ||
if (visited[i][j]) continue; | ||
visited[i][j] = true; | ||
if (matrix[i][j] === 0) continue; | ||
currentRiverSize++; | ||
const unvisitedNeighbors = getUnvisitedNeighbors(i, j, matrix, visited); | ||
for (const neighbor of unvisitedNeighbors) { | ||
nodesToExplore.push(neighbor); | ||
} | ||
} | ||
if (currentRiverSize > 0) sizes.push(currentRiverSize); | ||
} | ||
|
||
function getUnvisitedNeighbors(i, j, matrix, visited) { | ||
const unvisitedNeighbors = []; | ||
if (i > 0 && !visited[i - 1][j]) unvisitedNeighbors.push([i - 1, j]); | ||
if (i < matrix.length - 1 && !visited[i + 1][j]) | ||
unvisitedNeighbors.push([i + 1, j]); | ||
if (j > 0 && !visited[i][j - 1]) unvisitedNeighbors.push([i, j - 1]); | ||
if (j < matrix[0].length - 1 && !visited[i][j + 1]) | ||
unvisitedNeighbors.push([i, j + 1]); | ||
return unvisitedNeighbors; | ||
} | ||
|
||
export default riverSizes; |
Oops, something went wrong.