This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def make_change(change, denominations=None): | |
""" | |
Given an integer amount of change and a list of denominations of coins | |
you can use to make it, return the least amount of coins to make change | |
:param change: | |
:param denominations: | |
:return: | |
""" | |
if denominations is None: | |
# start with some sensible (American) defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting(E_NONE); | |
$repetitions = 10000; | |
function getmicrotime() | |
{ | |
$t = gettimeofday(); | |
return $t['sec'] * 1000 + $t['usec'] / 1000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Searches through the current tree for a given key. Will return a match if | |
* a node exists that has a value that starts with key or is equal to key. | |
* All comparisons are in lowercase. | |
* | |
* @param key The key containing the value to search for | |
* @return The node if it finds it | |
* @throws EmptyTreeException If the current tree is empty | |
* @throws NodeNotFoundException If the node isn't found | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
// Old Code | |
function CheckCC($field, $msg) | |
{ | |
$Name = 'n/a'; | |
$Num = $this->_getValue($field); | |
// Innocent until proven guilty | |
$GoodCard = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void deleteNode(int key) { | |
Term current = this.first; | |
while(current != null){ | |
if(((Term)current.next).getCoefficient() == key){ | |
Term t = (Term) current.next.next; | |
current.next.next = null; | |
current.next = t; | |
} else { | |
current = (Term) current.next; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gilleland.george.homework; | |
import com.gilleland.george.utils.ImproperInsertionOrderException; | |
import com.gilleland.george.utils.InvalidPolynomialExpressionException; | |
import com.gilleland.george.utils.Link; | |
import com.gilleland.george.utils.LinkListInterface; | |
import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression; | |
import java.util.ArrayList; | |
import java.util.List; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void run() { | |
while (true) { | |
ArrayList<String> menu_choices = new ArrayList<String>() {{ | |
add("Read"); | |
add("Generate"); | |
add("Print"); | |
add("Sort"); | |
add("Search"); | |
}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def primes(): | |
""" | |
Generate an infinite series of primes based on the | |
Sieve of Eratosthenes | |
""" | |
D = {} | |
q = 2 | |
while True: | |
if q not in D: | |
yield q |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gilleland.george; | |
import com.gilleland.george.utils.Utils; | |
import java.util.ArrayList; | |
public class Main { | |
public static void main(String[] args) { | |
// write your code here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sqrt | |
class Stats(object): | |
def __init__(self, dataset): | |
""" | |
A basic statistics class. Takes in a dataset of a list of numbers | |
""" | |
self.dataset = dataset |