Skip to content

Instantly share code, notes, and snippets.

View JSeam2's full-sized avatar

Jseam JSeam2

View GitHub Profile
@JSeam2
JSeam2 / fibiter.py
Created November 21, 2017 05:34
Calculate Fibonacci Sequence Iteratively w/ and w/o memoization
"""
fib iterative version
with memoization
"""
def fib(n):
a, b = 0, 1
for x in range(1, n + 1):
a, b = b, a+b
return a
@JSeam2
JSeam2 / fact.py
Created November 21, 2017 04:50
Dynamic Programing Factorial Calculation.
# -*- coding: utf-8 -*-
"""
no difference
"""
import time
import matplotlib.pyplot as plt
table = {0:1}
def fact1(n):
if n in table:
@JSeam2
JSeam2 / Hail.java
Created September 12, 2017 01:44
Javascript for hail
import java.util.ArrayList;
public class Hailstone{
public static void main(String[] args){
System.out.println(Hail(3));
}
public static ArrayList Hail(int n){
ArrayList<Integer> HS = new ArrayList<Integer>();
HS.add(n);
@JSeam2
JSeam2 / Keybase.md
Created June 30, 2017 09:22
Keybase stuff

Keybase proof

I hereby claim:

  • I am jseam2 on github.
  • I am jseam (https://keybase.io/jseam) on keybase.
  • I have a public key whose fingerprint is E9EA 85C8 0452 7CF0 3A09 BFAA BEFB D1C8 CCCF E445

To claim this, I am signing this object:

@JSeam2
JSeam2 / Winning.py
Last active February 10, 2017 14:56
Check if you won Spool's toto. A simple script to reduce hassle
def any_win(win_num, additional, my_num):
"""
Check if there's a win
:param win_num: the winning numbers (list of int)
:param addtional: additional number (int)
:param my_num: my numbers (list of int)
:return: Top Category of Win or No Win (str)
"""
# temporary list