Skip to content

Instantly share code, notes, and snippets.

@jdw1996
jdw1996 / max_people_living.py
Created January 27, 2017 05:37
An interview-style programming question.
#!/usr/bin/env python3
# Joseph Winters
# January 27, 2017
# Given a list of people with birth years and death years, all of which fall in
# the range [1900, 2000], find the year in which the most people were alive. If
# a person is alive for any part of a year, they count towards the total number
# of living people for that year.
@jdw1996
jdw1996 / data-creation.sql
Last active March 25, 2018 15:18
Code snippets used in my blog post on nesting aggregate functions in SQL: https://jdw1996.github.io/2017-03-26-nesting-sql-aggregate-functions.html
-- Create the table to hold our data.
CREATE TABLE purchases (
name VARCHAR(5),
amount DECIMAL(5,2),
year CHAR(4)
);
-- Insert the example data.
@jdw1996
jdw1996 / co454a4q2a.py
Created July 3, 2018 21:25
Spring 2018 CO454 A4 Q2(a) Solver
#!/usr/bin/env python3
#
# Joseph Winters
# July 2018
# CO 454 Assignment 4, Question 2
#
import sys
import math
@jdw1996
jdw1996 / bqf-reduction.py
Created July 15, 2018 23:59
Spring 2018 PMATH340 BQF Reduction Algorithm
#!/usr/bin/env python3
# Joseph Winters
# Reduction Algorithm
# July 2018
# This script implements the reduction of primitive, positive definite binary
# quadratic forms, which are those of the form:
# ax^2 + bxy + cy^2
# having: