Skip to content

Instantly share code, notes, and snippets.

@weburnit
Created February 10, 2017 05:52
Show Gist options
  • Save weburnit/ec4a19328d7f332567bc6bd2d7b12a69 to your computer and use it in GitHub Desktop.
Save weburnit/ec4a19328d7f332567bc6bd2d7b12a69 to your computer and use it in GitHub Desktop.
Star War Challenge - Jedi vs Sith
/*
# StarWar Challenge
## Summary:
The Sith have sent Lord Malice to find the last standing Jedi temple on an unknown planet.
We need to find what planet it is on before he does.
## Intel:
The Jedi temple is on a planet that the majority of the oldest Jedis were born on
but no Sith was ever born on. Unfortunately, all we have is old birth records
recovered from some ruins that needs to be decoded and processed.
The records have a scrambled name apart from the first one (Unkar Lop)
and doesn't tell the who is Sith and who is Jedi, but we know there is a
pattern between birth years of Jedi and Sith and that Jedi are older.
## Goals:
Figure out each person's name. Output names and whether Jedi or Sith.
Find which planet the last temple is located on, output result.
## Notes:
Write algorithms manually and comment with Big O complexities
The dates are in YYYY-MM-DD format
Proper tests are HIGHLY favored
Upload to Github or as a Gist and return the URL to us
*/
var records = [
{ name: "Unkar Lop", birth: "1727-01-25", planet: "Felucia" },
{ name: "lowatp", birth: "1723-11-10", planet: "Coruscant" },
{ name: "npoolno", birth: "1726-01-04", planet: "Felucia" },
{ name: "alnappopaw", birth: "1460-10-01", planet: "Hoth" },
{ name: "supwwlanabohum", birth: "1129-05-28", planet: "Tatooine" },
{ name: "jplooe", birth: "1614-03-15", planet: "Felucia" },
{ name: "walollpace", birth: "1503-05-24", planet: "Tatooine" },
{ name: "preiolsha", birth: "1609-06-04", planet: "Coruscant" },
{ name: "ypirumolpa", birth: "1134-11-19", planet: "Hoth" },
{ name: "mopuamangl", birth: "1731-07-05", planet: "Tatooine" },
{ name: "lnpooto", birth: "1455-01-06", planet: "Tatooine" }
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment