Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
# Ensure that your CWD is your project root
wget https://pypi.python.org/packages/source/s/simpy/simpy-3.0.5.tar.gz#md5=19262488f1b0e6b77556820dd2b42d67
tar xzf simpy-*.tar.gz
mv simpy-*/simpy .
# Cleanup deployment artifacts
rm simpy-*.tar.gz
rm -rf simpy-*
@Hydrotoast
Hydrotoast / non_adjacent.py
Created January 14, 2015 19:04
Find the max sum without using any adjacent indeces of the array.
A = [8,1,3,4,5,10]
ans = 22
def non_adjacent_sum(A):
# Small cases
if len(A) < 3:
return max(A)
# Base cases
prev_prev, prev = A[0], A[1]
.svm-example {
position: relative;
height: 60px;
width: 340px;
margin: 1.5em auto;
line-height: 60px;
}
.svm-example div {
position: absolute;
top: 10px;
import numpy as np
# The Fibonacii matrix
M = np.array([[0, 1], [1, 1]], dtype=np.float32)
# Compute the eigendecomposition of the matrix
w, v = np.linalg.eig(M)
inv_v = np.linalg.inv(v)
base_case = np.array([0, 1]).T # base case as a column vector