Hello! Please complete the following problems and send the solution to web@everlane.com. When you are solving the Ruby question, you may instead opt to use a language of your choice, as long as that language isn't named Java or C#.
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
{ | |
"requireCurlyBraces": [ | |
"if", | |
"else", | |
"for", | |
"while", | |
"do", | |
"try", | |
"catch" | |
], |
Front End Engineering question Given an array, return it's flattend structure.
[1, [2, [3]]] -> [1, 2, 3]
[1, [2, 3], 4] -> [1, 2, 3, 4]
possible total 24 points
- result [4]
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
const isRelative = filePath => filePath.charAt(0) === '.'; | |
const normalizePath = (context, filePath) => { | |
const out = context.split('/').filter(c => c).slice(0, -1); | |
filePath.split('/').forEach((token) => { | |
switch (token) { | |
case '.': | |
case '': | |
break; | |
case '..': |
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
_onUpdate = (predicate: (item: Item) => boolean, update: (item: Item) => Item) => { | |
const { data, onUpdate } = this.props; | |
onUpdate(group => group.id === data.id, (group) => { | |
const items = group.items.map((item) => { | |
if (!predicate(item)) { | |
return null; | |
} | |
return update(item); | |
}); | |
if (items.filter(i => i).size) { |
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
import { List } from 'immutable'; | |
import Item from './records/Item'; | |
import Group from './records/Group'; | |
const safeSet = (item, field, val) => { | |
if (item[field] !== val) { | |
return item.set(field, val); | |
} | |
return item; | |
}; | |
const isActive = (name, activeNames = []) => activeNames.indexOf(name) !== -1; |
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
const m = 10; | |
const n = 10; | |
const enemyShips = []; | |
class Ship { | |
constructor(x1, y1, x2, y2) { | |
this.x1 = x1; | |
this.y1 = y1; | |
this.x2 = x2; |
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
// The other player starts with a code that you are trying to guess | |
// the code is 4 digits 1-6, on each guess the other player will | |
// tell you the number of digits in your guess that are in the final solution | |
// and the exact number of digits that matches. | |
// e.g. code: '1234', guess: '1111' => '1 1' | |
const parse = (code) => code.split('').map((n) => parseInt(n, 10)); | |
const MASTER_CODE = parse('1234'); |
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
{ | |
"workbench.iconTheme": "vscode-icons", | |
"editor.tabSize": 2, | |
"terminal.integrated.fontFamily": "Source Code Pro for Powerline", | |
"window.zoomLevel": 0, | |
} |
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
class Path { | |
constructor(node, parent = null, key = null) { | |
this.node = node; | |
this.parent = parent; | |
this.key = key; | |
} | |
replace(node) { | |
node.leadingComments = [...(this.node.leadingComments || [])]; | |
node.trailingComments = [...(this.node.trailingComments || [])]; |
OlderNewer