Skip to content

Instantly share code, notes, and snippets.

@evandrix
Created August 17, 2011 00:36
Show Gist options
  • Save evandrix/1150530 to your computer and use it in GitHub Desktop.
Save evandrix/1150530 to your computer and use it in GitHub Desktop.
This grid shows the restaurants in Hamburg which have E la Carte units ("Prestos") installed in
them. The Ps in the grid represent restaurants with Prestos installed ("Prestorants"). Os
represent restaurants without prestos.
Alyssa P. Hacker from the E la Carte ops team wants to count the number of restaurants in the
largest contiguous rectangular block of Prestorants. What is the number that she comes up with?
Answer: __44__
top-left corner: (15, 5742)
bottom-right corner: (18, 5752)
...where (0,0) is top-leftmost corner; right-down are positive x-y directions
Chef Claudio loves to have food specials but likes knowing what each day's specials are to be a
challenge. So, he assigns a random 3-digit alphanumeric code to each of the 250 items he might
make and publishes this list. Each day, he chooses a set of five items to make and uses a grid
with a square for each of the 36 letters/numbers to let guests know if a particular item they
want is a special that day. To do this, for each of the digits of each item, he crosses out that
square on the grid (if the square is already crossed out, he makes no change).
What is the probability (to the ten-thousandths place) that a guest chooses an item and the grid
makes it appear to be today's special when in fact it is not?
Answer: (1-(1-1/36)^(15))^3 -> 0.0409 [parameters: k=3; n=5; m=36]
What is the probability (to the ten-thousandths place) that a guest chooses an item and the grid
makes it appear to be unavailable as today's special when in fact it is available?
Answer: 0 (false negatives not possible)
data:image/gif;base64,R0lGODlhCQE4AOMAAAAAAJmZmXd3d1VVVe7u7jMzM8zMzBEREaqqqoiIiGZmZv///0RERN3d3SIiIru7uyH5BAEAAAsALAAAAAAJATgAQAT+cMlJq7046827/2AojmRpjopwrmzbCOrWOIZWFEzT7nwvEgCED9M4CIcWAWPDiLUKTqR0WnoAXooMY5kxRE2HL8XLewgK4QAHkGhZH1TE9UL2WbESxSAhGNQkAnB5e30IAgpqFVsiVmIUSiyQGZJUGW8tAFweDAMwYQSAiRWXF5QjAgCVGE0iqDqVAgdUAg0MDqABAIkAghYJAKAsCqmVA5qqVAEHwSMNusgLZ9AZCMs8DlnT2tvc3d4he9/iyL/MqrTeAb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YffNkjUEaAyI3Rv0miHejzDYn33+CPNt+eUHFwzA56CHDvrdK3sgIAcE8MaAVQYI/Ld3FzR43225wBB2F447mbtPlE8ttH4LfvN6zCC4bAC1ShRwuKWVm2AFrrubgGFzCuhwOkC9yZX1Cj3jGD0IRQLbuwY0V+LM7eOU5QbAUii+14cilAQyFQaWJ4CEKCWAgPJEMF+CwvQziaJS5gGjVcZ/PAiAVvLgFGf4aQA7O4EDfoYEggVqeiB4FTlSJQVstUgQ/hiSLzi4glwhIyjo2wvHTKCP0kWCgjwoCneIYgj6YIUFTJsGAqS2FzOwwCHS4sF7MAXDEmQkiOA6x8RgwUNVrI0HQEziPQLAPymWAFVWxEcPUFyYRQpgsItgDKMYKxABADs%3D
rot13 is an ancient encryption scheme that is notably not very secure. The basic idea is that
you assign each letter a number (a =0, b = 1, c = 2, ... ). Then you have some value that you
'rotate' the numbers on... essentially adding to the initial letter's value modulo the total
number of letters. Example: b with a rotation of 12 is ( (1 + 12) % 26 ) = 13.
Assume that your program has an encrypted message (that has the spaces originally removed) as
input, as well as a large dataset in the original language (i.e. a book worth of text). How
would you decode the encrypted message (find out what the rotation number is) including
re-inserting the spaces?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment