Giter VIP home page Giter VIP logo

fbinvite's Introduction

Facebook Invite Challenge
Copyright (c) 2010  Peter Heinrich

When Facebook opened their Seattle office, they wanted to celebrate with an
open-house (recruiting) party in their new space.  Since space was limited,
however, they chose to limit invitations to those who could solve a little
puzzle they devised.

http://www.facebook.com/note.php?note_id=146727365346299

Actually, solutions to two puzzles were required, since the post above didn't
explicitly reveal the URL where details of the challenge could be found.  In-
stead, a partial URL was listed, with clues describing the last portion:

  http://www.facebook.com/seattle/[insert-word-here]

  The first occurrence of 'e' comes before 1 occurrence of 's'.
  The first occurrence of 'i' comes before 1 occurrence of 'n'.
  The first occurrence of 'i' comes before 1 occurrence of 'i'.
  The first occurrence of 'n' comes before 2 occurrences of 'e'.
  The first occurrence of 'e' comes before 1 occurrence of 'e'.
  The first occurrence of 'i' comes before 1 occurrence of 'v'.
  The first occurrence of 'n' comes before 1 occurrence of 'i'.
  The first occurrence of 'n' comes before 1 occurrence of 'v'.
  The first occurrence of 'i' comes before 1 occurrence of 's'.
  The first occurrence of 't' comes before 1 occurrence of 's'.
  The first occurrence of 'v' comes before 1 occurrence of 's'.
  The first occurrence of 'v' comes before 2 occurrences of 'e'.
  The first occurrence of 't' comes before 2 occurrences of 'e'.
  The first occurrence of 'i' comes before 2 occurrences of 'e'.
  The first occurrence of 'v' comes before 1 occurrence of 't'.
  The first occurrence of 'n' comes before 1 occurrence of 't'.
  The first occurrence of 'v' comes before 1 occurrence of 'i'.
  The first occurrence of 'i' comes before 1 occurrence of 't'.
  The first occurrence of 'n' comes before 1 occurrence of 's'.

I'm not much for word games or anagrams (actually, I hate them), so I wasn't
interested in puzzling through this--maybe it was straightforward, I don't
know.  Instead, I took the easy way:

peter@Ancaeus ~ $ aspell dump master > dict.txt
peter@Ancaeus ~ $ egrep "[^s]*e.*s" dict.txt | egrep "[^n]*i.*n" | egrep "^([^i]*i[^i]*){2}" | egrep "[^n]*n[^e]*e[^e]*e" | egrep "^([^e]*e[^e]*){2}$" | egrep "[^v]*i.*v" | egrep "[^n]*n.*i" | egrep "[^n]*n.*v" | egrep "[^i]*i.*s" | egrep "[^t]*t.*s" | egrep "[^v]*v.*s" | egrep "[^v]*v[^e]*e[^e]*e" | egrep "[^t]*t[^e]*e[^e]*e" | egrep "[^i]*i[^e]*e[^e]*e" | egrep "[^v]*v.*t" | egrep "[^n]*n.*t" | egrep "[^v]*v.*i" | egrep "[^i]*i.*t" | egrep "[^n]*n.*s"
invitees
vindictiveness
vindictiveness's

Not pretty, but straightforward, since the regexes can basically be copied
directly from the individual clues.  Only three words satisfied all the con-
straints, and it seemed pretty clear which was intended.

I subsequently refined the expression, since the clues make it clear that:

  1. only the letters e, i, n, s, t, and v appear in the word
  2. the letter s appears exactly once, at the end
  3. the letters e and i appear exactly twice

peter@Ancaeus ~ $ aspell dump master | egrep "^[eintv]{7,}s$" | egrep "n.*e{2}" | egrep "v.*e{2}"
invitees

With the URL cracked, the real programming challenge was revealed: use the
Facebook Graph API to determine which of your friends shared the most likes and
interests with you.  I think most people would agree that this was almost too
easy, since (as I discovered) Facebook's Graph API makes this kind of thing a
snap.

fbinvite's People

Contributors

pheinrich avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.