Hacker News new | ask | show | jobs
by giancarlostoro 2384 days ago
I am still wondering how the two Perl ones work with two missing words in the code.
3 comments

Since each hand beats two other hands, you only need three possible outputs to beat any opposing hand.
The conclusion does not follow...

(the missing condition is that every hand is beatable)

There are 5 possible hands

Each hand beats 2 distinct hands

With 3 distinct hands you can cover up to 6 distinct hands which is a superset of all possible hands

3 * 2 > 5

And yet...

  A --> D | E
  B --> D | E
  C --> D | E
  D --> C | E
  E --> D | C
QED
Um, this isn't a general math problem; We're not solving for all possible sets. We're solving this problem in particular:

  A --> B | C
  B --> C | D
  C --> D | E
  D --> E | A
  E --> A | B
The question is not clear. You don’t need to output the string “Rock or Spock”, you need to output either the string “Rock” or the string “Spock”.
Rock: 4-letters (Mod4 == 0)

Paper: 5-letters (Mod4 == 1)

Spock: 5-letters (Mod4 == 1)

Lizard: 6-letters (Mod 4 == 2)

Scissors: 8-letters (Mod 4 == 0)

----------

There are no 3-letter or 7-letter words (aka: Blah % 4 != 3 given the inputs). So they just left the 3rd index (4th word) empty.