Skip to content

Instantly share code, notes, and snippets.

@spion
Created March 20, 2014 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spion/9667346 to your computer and use it in GitHub Desktop.
Save spion/9667346 to your computer and use it in GitHub Desktop.
function solve(acronym, expansion, n) {
var pos = expansion.indexOf(acronym),
translated = pos ? n % pos :
acronym.length +
(n - acronym.length) %
(expansion.length - acronym.length);
return expansion[translated];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment