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://www.codewars.com/kata/52b7ed099cdc285c300001cd/train/javascript | |
| function sumIntervals(intervals){ | |
| intervals = intervals.sort(function(a, b) { // O(n) | |
| return a[0] - b[0]; | |
| }); | |
| intervals = intervals.reduce(function(acc, el, index, array) { // O(n) | |
| const anterior = array[index - 1]; | |
| if (array.length > 1 && anterior !== undefined) { | |
| if (el[0] < acc[acc.length - 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
| const { performance } = require('perf_hooks'); | |
| const encontrarFrases = (target, matchings) => { | |
| const hashTarget = target.toLowerCase().split('').reduce((acc, letter) => { | |
| if (letter === ' ') { | |
| return acc; | |
| } | |
| acc[letter] = (acc[letter] || 0) + 1; | |
| return acc; | |
| }, {}); |
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
| echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p |