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 bestChange(denominations, amount): | |
if amount == 0: | |
return [] | |
for i in denominations: | |
if i <= amount: | |
return [i] + bestChange(denominations, amount-i) | |
denominations = [100, 50, 20, 10, 5, 2, 1] | |
amount = 109 |
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 | |
function fch($csm) | |
{ | |
if($csm < 0) | |
$csm += 4294967296.0; | |
$a = (int)fmod($csm, 10); | |
$t = 1; | |
$b = (int)($csm / 10); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<test> | |
<case>42</case> | |
</test> |
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 | |
/* | |
Usage: |
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 | |
$url = 'http://api.uwaterloo.ca/public/v1/?'; | |
$url .= 'key=&service=staffinfo&q='.$q[0]; | |
$get = file_get_contents($url); | |
$json = json_decode($get); | |
$data['name'] = $json->response->data->Name; | |
$data['dept'] = $json->response->data->Department; |
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 | |
$url = 'http://api.uwaterloo.ca/public/v1/?key=apikey&'; | |
$url .= 'service=publicationdetails&q='.$_GET['q']; | |
$get = json_decode(file_get_contents($url))->response->data; | |
$data['title'] = $get->Title; | |
$data['authors'] = $get->Authors; | |
$data['approved'] = $get->Approved; | |
$data['abstract'] = $get->Abstract; |
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 itertools | |
possible = ['1', '2', '3', '4', '5'] | |
doubles = [] | |
brute = [] | |
def stringPermutations(string): | |
rez = [] |
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
Grooveshark: Help, I'm Alive Metric | |
Spotify: Help I'm Alive Metric | |
spotify:track:3GcH8qkC35CQc4xt6Dhz1r | |
Grooveshark: Never Gonna Leave This Bed Maroon 5 | |
Spotify: Never Gonna Leave This Bed Maroon 5 | |
spotify:track:4ucLHLiSjvkCz5Lr5dlVUj | |
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
""" | |
Beautiful Strings | |
When John was a little kid he didn't have much to do. There was no internet, no Facebook, | |
and no programs to hack on. So he did the only thing he could... he evaluated the beauty | |
of strings in a quest to discover the most beautiful string in the world. | |
Given a string s, little Johnny defined the beauty of the string as the sum of the beauty | |
of the letters in it. |