Skip to content

Instantly share code, notes, and snippets.

View f1lander's full-sized avatar
🦎
picheteando

ethdax f1lander

🦎
picheteando
View GitHub Profile
@f1lander
f1lander / find-pairs.js
Last active October 10, 2019 21:53
Find count of pairs of HackerRank code challenge
const ar = [10, 20, 20, 10, 10, 30, 50, 10, 20];
const getPairs = (n, ar) => {
let pairs = 0, i = 0;
ar.sort((a, b) => a - b);
while (i < n) {
const count = ar.filter(item => item === ar[i]).length;
if (count >= 2) {
/**
Example Code for developer position application
Write some code, that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers. e.g. [[1,2,[3]],4] -> [1,2,3,4].
For this code I'll use JS (es6) running in NodeJS v11
Instructions:
const xtreme_math = require("../../ceutek/deunitek/xtreme-math");
const math = new xtreme_math(3);
console.log(math.square); // resultado: 9.
const xtreme_math = require("../../ceutek/deunitek/xtreme-math");
const math = new xtreme_math(3);
console.log(math.square); // resultado: 9.