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
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Random; | |
import java.util.TreeSet; | |
/** | |
* This is a programming exercise to generate a series of random doubles between | |
* 0.0 and 1.0 and return an ordered list of the count of the first digit after |
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
""" | |
Given a list of change denominations and a target amount of money, | |
calculate the number of ways to make that amount of change. | |
""" | |
def calculate_variations(total, denomination): | |
""" | |
return all possible sequences of denomination whose sum is <= desired_sum | |
""" | |
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
""" | |
Programming exercise to print all the permutations of an input string. | |
""" | |
import sys | |
def get_permutations(string): | |
permutations = [] | |
if len(string) == 1: |
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
""" | |
This is a programming exercise to solve the towers of hanoi puzzle. | |
The physical puzzle has three pegs in a row. On the first peg is a | |
stack of disks of descending diameter. You are only allowed to put | |
a smaller disk on top of a larger disk, never the reverse. The task | |
is to move the entire pile from the far left peg, to the far right | |
peg. | |
This script accepts one input argument, n, for the number of disks. | |
""" |
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
""" | |
This is a programming exercise to print a spiral array of numbers to | |
the screen. The spiral starts with 0 in the middle (or upper left of | |
the middle square) and iterates in concentric square spiral pattern in | |
a clockwise direction. | |
""" | |
import sys | |
import math |
NewerOlder