Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Cipher Map by vvm70
import assert from "assert";
function recallPassword(grille: string[], b: string[]): string {
let s = "";
for(let i = 0; i < 4; i++) {
s += b.join('').split('').filter((x, i) => grille.join('')[i] == 'X').join('');
let g = ["", "", "", ""];
for(let j = 0; j < 4; j++)
for(let i = 3; i >= 0; i--)
g[j] += grille[i][j];
grille = g;
}
return s;
}
console.log('Example:');
console.log(recallPassword(['X...', '..X.', 'X..X', '....'],
['itdf', 'gdce', 'aton', 'qrdi']));
// These "asserts" are used for self-checking
assert.equal(recallPassword(['X...', '..X.', 'X..X', '....'],
['itdf', 'gdce', 'aton', 'qrdi']), 'icantforgetiddqd');
assert.equal(recallPassword(['....', 'X..X', '.X..', '...X'],
['xhwc', 'rsqx', 'xqzz', 'fyzr']), 'rxqrwsfzxqxzhczy');
console.log("Coding complete? Click 'Check' to earn cool rewards!");
Sept. 1, 2020