Skip to content

Instantly share code, notes, and snippets.

View yagoff's full-sized avatar

Yago Ferro Figueira yagoff

View GitHub Profile
@yagoff
yagoff / palindrome.js
Last active September 25, 2016 11:04
Palindrome hackerrank solve
const _ = require('lodash');
function solve(input, n) {
const combinations = k_combinations(getArrayToN(input.length), n);
let palindrome = 0;
for (let i = 0; i < combinations.length - 1; i++) {
let candidate = '';
let previous = 0;
for (let j = 0; j < combinations[i].length; j++) {
if (combinations[i][j] === _.last(combinations[i])) {