Find the missing permutation: Difference between revisions

Content added Content deleted
Line 1,166: Line 1,166:
return transpose(xs.split(' ')
return transpose(xs.split(' ')
.map(x => x.split('')))
.map(x => x.split('')))
.map(col => col.reduce((a, x) => { // char count in each of N columns ?
.map(col => col.reduce((a, x) => (
return (
a[x] = (a[x] || 0) + 1,
a[x] = (a[x] || 0) + 1,
a
a
), {}))
);
}, {}))
.map(dct => { // character with frequency below mean of distribution ?
.map(dct => { // character with frequency below mean of distribution ?
let ks = Object.keys(dct),
let ks = Object.keys(dct),