Skip to content

Instantly share code, notes, and snippets.

View BeKnowDo's full-sized avatar
:bowtie:
Focusing

Cesar Perez BeKnowDo

:bowtie:
Focusing
View GitHub Profile
@BeKnowDo
BeKnowDo / contiguous-groups.js
Created June 12, 2017 18:16
Contiguous Groups
const ContiguousGroups = (array) => {
const arrayValues = array.sort();
let contiguousCount = 0,
foundMatch = false;
arrayValues.map(function(item, index) {
let findDifference = Math.abs(item - arrayValues[index + 1]);
if (!isNaN(findDifference) && findDifference === 0) {
@BeKnowDo
BeKnowDo / wordmachine.js
Created June 12, 2017 18:15
Wordmachine
const wordMachine = (commands) => {
const operations = commands.split(' ');
let stack = [];
commandCount = 0;
operations.map((item, index) => {
let detectInteger = parseInt(item);
commandCount++;
//console.log(stack);