Skip to content

Instantly share code, notes, and snippets.

Eduard Rastoropov LAITONEN

Block or report user

Report or block LAITONEN

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Python_Challenge_2.js
const riddle = 'g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr... amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyrq... ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb.... lmu ynnjw ml rfc spj.';
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
const orderNumber = alphabet.split('').map((v, i) => {
return { newIndex: i+2, letter: v };
})
const result = riddle.split('').map(v => {
if (/[a-z]/.test(v)) {
return orderNumber[orderNumber[alphabet.indexOf(v)].newIndex].letter;
}
View gist:2e5e754ab9a05bdc1847410ac137dca6
import _ from 'lodash';
// count duplicates in the array and return the object, where 'key' is a unique value from the array
// and value is a number of duplicates of this value in the array
export function countDuplicates (array) {
const object = {};
array.filter((v, i, a) => i === a.indexOf(v))
.forEach(v => object[v] = object[v] ? object[v] + 1 : 1);
You can’t perform that action at this time.