- Give an algorithm to find the longest common subsequence for two given strings using edit distance (the minimal number of additions, deletions and substitutions needed to transform one string into the other).
This file contains hidden or 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
from django.conf import settings | |
from django.db import models | |
# A Batch represents one batch, and may be assigned to multiple | |
# users. | |
class Batch(models.Model): | |
name = models.CharField(max_length=200) | |
assigned_users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True) | |
def __str__(self): |
This file contains hidden or 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
{-# LANGUAGE GADTs, RankNTypes, TypeFamilies, DataKinds, DeriveFunctor, TypeOperators #-} | |
import Data.Type.Equality | |
import Data.List (intercalate) | |
import Data.Maybe (catMaybes) | |
data HasVars = Var | NoVar | |
data SHasVars a where | |
SVar :: SHasVars Var |
This file contains hidden or 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
data StockState = StockState { hi :: Int, lo :: Int, lowest :: Int } | |
deriving Show | |
solve xs = (hi st) - (lo st) | |
where | |
st = solve' xs | |
solve' [] = StockState 0 0 0 | |
solve' (x:xs) = foldl go (StockState 0 0 x) xs | |
where |
This file contains hidden or 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
assignment = __dirname.substr(__dirname.lastIndexOf('/') + 1) | |
module.exports = (grunt) -> | |
grunt.initConfig | |
watch: | |
files: ['!full.tex', '*.tex'] | |
tasks: 'exec:pdf' | |
options: | |
event: ['changed'] | |
exec: |
This file contains hidden or 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
\documentclass[a4paper,english]{article} | |
%% Use utf-8 encoding for foreign characters | |
\usepackage[T1]{fontenc} | |
\usepackage[utf8]{inputenc} | |
\usepackage{babel} | |
\usepackage{graphicx} | |
\usepackage{siunitx} | |
%% Vector based fonts instead of bitmaps |
This file contains hidden or 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
\documentclass[11pt, oneside]{article} % use "amsart" instead of "article" for AMSLaTeX format | |
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots. | |
\geometry{letterpaper} % ... or a4paper or a5paper or ... | |
%\geometry{landscape} % Activate for for rotated page geometry | |
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent | |
\usepackage{graphicx} % Use pdf, png, jpg, or eps with pdflatex; use eps in DVI mode | |
% TeX will automatically convert eps --> pdf in pdflatex | |
\usepackage{amssymb} | |
\usepackage{amsmath} | |
\usepackage{epigraph} |
Fun problems (rendered at http://mathb.in/18258)
-
Find
$\displaystyle\sum_{n=1}^\infty \frac{n}{2^n}$ -
Find
$\displaystyle\sum_{n=1}^\infty \frac{n^2}{2^n}$ -
Let
$a(k) = \displaystyle\sum_{n=1}^\infty \frac{n^k}{2^n}$ . Find a recurrence relation for$a(k)$ . -
Let
$\mathcal{N}$ be the set of natural numbers that do not contain a 6 in their decimal expansion (so,$\mathcal{N} = { 1, 2, 3, 4, 5, 7, \ldots, 14, 15, 17, \ldots }$ ). Prove that $$ \sum_{n\in\mathcal{N}} \frac{1}{n} < 80 $$
Table of contents
This file contains hidden or 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
import requests | |
import os | |
twilio_sid = os.environ['TWILIO_SID'] | |
twilio_auth = os.environ['TWILIO_AUTH'] | |
twilio_url = 'https://api.twilio.com/2010-04-01/Accounts/%(twilio_sid)s/SMS/Messages.json' % locals() | |
weather_url = 'http://api.openweathermap.org/data/2.5/weather' | |
weather_params = {'q': 'montreal'} | |
r = requests.get(weather_url, params=weather_params) |
NewerOlder