Snippets
These are a collection of code snippets and notes I've written in the past and saved. Some are algorithms that I find interesting, some are mathematical theorems, and some are just puzzles that I've solved.
Ordinary Least Squares
A method for choosing the unknown parameters in a linear regression model.
Simple Linear Regression
A linear regression model with a single explanatory variable.
Modern Portfolio Theory
A mathematical framework for assembling a portfolio of assets.
Buy and Sell Stock
Find the best time to buy and sell stock to achieve maximum profit.
Buy and Sell Stock IV
Find the best time to buy and sell stock to achieve maximum profit.
Minimum Depth of a Binary Tree
Given a binary tree, find its minimum depth.