This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Code to return the alphabet in which a list of words is sorted. | |
Imagine that you are given a list of words (eg: best friends forever), along | |
with the claim that these words are lexicographically sorted for *some* | |
alphabet. Your job is to determine whether this is true, and if it is, return | |
an example of such an alphabet. | |
This module implements an algorithm to solve this problem. It creates a graph | |
of dependencies between letters, performs a topological sort, and then returns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Finds optimal strategy for gambling chip game. | |
Problem: two players (Alice and Bob) play a game where gambling chips (with | |
numeric values) are laid out in a line. They alternate turns. During their | |
turn, a player picks up a chip on either end of the line, but not from anywhere | |
in the middle, and adds that chip to their collection. At the end, the player | |
with the higher valued collection of chips wins. | |
This is a dynamic programming algorithm for solving the problem. It runs in |
- Cats, as defined by how important they were as plot devices (the cat from The Matrix would inherit from
ImportantCat
, whereas the cat from Boondock Saints would inherit fromDeadCat
) - Batman (primarily as a way to describe situations in which a child has no parents)
- Presidents of the United States (Nixon vs Cheney vs Garfield)
- Zombies (Walking Dead vs World War Z vs Zombieland)
- Zombie Presidents of the United States
- Children in television shows, as grouped by whether they actually did cause their parents' separation
- Radioactive attack squirrels bent on global hegemony, beamed down to Earth from the mirror universe USS Enterprise
- George Carlins by decade
- Cocaine
- Metropolises, cities, towns, villages, and Detroits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ revealedCharacter }}
// Just before switching jobs: | |
// Add one of these. | |
// Preferably into the same commit where you do a large merge. | |
// | |
// This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
// and then it quickly escalated into more and more evil suggestions. | |
// I've tried to capture interesting suggestions here. | |
// | |
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |