This file contains hidden or 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
| /* | |
| A string S consisting of N characters is considered to be properly nested if any of the following conditions is true: | |
| S is empty; | |
| S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string; | |
| S has the form "VW" where V and W are properly nested strings. | |
| For example, the string "{[()()]}" is properly nested but "([)()]" is not. | |
| */ | |
| var rb = { |
This file contains hidden or 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
| //http://codility.com/demo/take-sample-test/triangle | |
| function solution(arr) { | |
| if (arr.length < 3){ | |
| return 0; | |
| } | |
| arr.sort(function(a, b){return a - b;}); | |
| for (var i = 0, len = arr.length; i < len - 2; i++){ |
This file contains hidden or 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
| var five = num(5); | |
| var one = num(1); | |
| console.log(five(plus(one()))); //6 | |
| function plus(arg){ | |
| return function(arg2){ | |
| return arg + arg2; | |
| } | |
| } |
This file contains hidden or 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
| /* | |
| Результат | |
| [ | |
| ['1', '2', '3'], | |
| ['1-1', '1-2', '3-1', '3-2', '3-3'], | |
| ['1-2-1', '3-2-1', '3-2-2'] | |
| ] | |
| */ | |
| var input = [ |
This file contains hidden or 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
| # Your init script | |
| # | |
| # Atom will evaluate this file each time a new window is opened. It is run | |
| # after packages are loaded/activated and after the previous editor state | |
| # has been restored. | |
| # | |
| # An example hack to log to the console when each text editor is saved. | |
| # | |
| # atom.workspace.observeTextEditors (editor) -> | |
| # editor.onDidSave -> |
This file contains hidden or 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 delayed = (ms, fn, ctx) => (...args) => { | |
| setTimeout(fn.bind(ctx, ...args), ms); | |
| }; | |
| const revert = (arr) => arr.reduce((acc, curr, i, arr) => acc.concat(arr[arr.length - i - 1]), [] ); |
This file contains hidden or 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
| //https://github.com/visionmedia/debug | |
| function log() { | |
| // this hackery is required for IE8/9, where | |
| // the `console.log` function doesn't have 'apply' | |
| return 'object' === typeof console | |
| && console.log | |
| && Function.prototype.apply.call(console.log, console, arguments); | |
| } |
OlderNewer