55491e9e50f2fc92f3000074
This commit is contained in:
13
src/55491e9e50f2fc92f3000074.js
Normal file
13
src/55491e9e50f2fc92f3000074.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
const ride = (a, b) => {
|
||||||
|
const alph = 'abcdefghijklmnopqrstuvwxyz';
|
||||||
|
const map = new Map();
|
||||||
|
[...alph].map((c, i) => map.set(c.toUpperCase(), i + 1));
|
||||||
|
const cs = s => {
|
||||||
|
return [...s].reduce((a, b) => a * map.get(b), 1) % 47;
|
||||||
|
};
|
||||||
|
return cs(a) === cs(b) ? 'GO' : 'STAY';
|
||||||
|
};
|
||||||
|
|
||||||
|
ride('COMETQ', 'HVNGAT');
|
||||||
Reference in New Issue
Block a user