Skip to content

Instantly share code, notes, and snippets.

View ssboisen's full-sized avatar

Simon Stender Boisen ssboisen

View GitHub Profile
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace SuffixTreeAlgorithm
{
public class SuffixTree
{
open System;
open System.Diagnostics;
[<EntryPoint>]
let main argv =
let rec cc amount coins =
match (amount, coins) with
| (0,_) -> 1
| (_,[]) -> 0
| (amount,_) when amount < 0 -> 0
let memoize2 f =
let cache = ref Map.empty
fun a b ->
match (!cache).TryFind (a,b) with
| Some(cv) -> cv
| None ->
let v = f a b
cache := Map.add (a,b) v !cache
v