This file contains hidden or 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 ArithGeo(arr): | |
diff = arr[1] - arr[0] | |
multiple = arr[1]/arr[0] | |
isarith = True | |
isgeom = True | |
for i in range(0,len(arr)-1): | |
d = arr[i+1] - arr[i] | |
if d!=diff: | |
isarith = False | |
m = arr[i+1] / arr[i] |
This file contains hidden or 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
1. When the input was new Array(1,2,3,4) your output was incorrect. | |
2. When the input was new Array(2,6,18,54) your output was incorrect. | |
3. When the input was new Array(1,2,3,4,5,10,20) your output was incorrect. | |
4. When the input was new Array(1,2,3,4,5,6,7,88,2) your output was incorrect. | |
5. When the input was new Array(100,200,400,800,1600) your output was incorrect. | |
6. When the input was new Array(10,110,210,310,410,511) your output was incorrect. | |
7. When the input was new Array(10,110,210,310,410) your output was incorrect. | |
8. When the input was new Array(5,10,20,40,80) your output was incorrect. | |
9. When the input was new Array(-3,-4,-5,-6,-7) your output was incorrect. | |
10. When the input was new Array(1,5,9) your output was incorrect. |
This file contains hidden or 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
<div style='float:left;'> | |
Basil Masri | |
</div> | |
<div style='float:right'> | |
XXXXXXX | |
</div> | |
<div style='clear:both'></div> |
This file contains hidden or 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
#define B_0000 0 | |
#define B_0001 1 | |
#define B_0010 2 | |
#define B_0011 3 | |
#define B_0100 4 | |
#define B_0101 5 | |
#define B_0110 6 | |
#define B_0111 7 | |
#define B_1000 8 | |
#define B_1001 9 |
This file contains hidden or 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
/* borrowed partially from: http://stackoverflow.com/a/7577517/277800 */ | |
#define B_0000 0 | |
#define B_0001 1 | |
#define B_0010 2 | |
#define B_0011 3 | |
#define B_0100 4 | |
#define B_0101 5 | |
#define B_0110 6 | |
#define B_0111 7 | |
#define B_1000 8 |
This file contains hidden or 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
// get the x coordinate for bit set on the board. | |
// b must have exactly 1 bit set or else the behavior is undefined. | |
uint getX() { | |
static uint x_precomputed[67] = | |
{ | |
0, 7, 6, 0, 5, 0, 7, 0, | |
4, 3, 7, 4, 6, 4, 7, 1, | |
3, 0, 2, 5, 6, 1, 3, 3, | |
5, 1, 3, 4, 6, 3, 0, 0, | |
2, 7, 0, 1, 1, 1, 4, 5, |
This file contains hidden or 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
Write fizz to memory using cells 0 to 5 inclusive | |
[-]>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]<<<<< | |
Write buzz to memory using cells 6 to 11 inclusive | |
>>>>>> | |
[-]>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>[-]<<<<< | |
Cell 12 wil |
This file contains hidden or 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
#include <stdio.h> | |
int main() { | |
int i = 1; | |
for (; i <= 100; i ++) { | |
if (i % 3 == 0) | |
printf("Fizz"); | |
if (i % 5 == 0) | |
printf("Buzz"); | |
if (i % 3 != 0 && i % 5 != 0) |
This file contains hidden or 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
# word pattern => list of corresponding english words | |
pattern_words = defaultdict(list) | |
def get_pattern(word): | |
"""Return the pattern for the given word.""" | |
map = {} | |
letters = iter(string.lowercase) | |
pattern = '' | |
for char in word: | |
if char not in map: |
This file contains hidden or 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 find_mappings(cipher_words, mapping=defaultdict(lambda:None)): | |
"""Return a generator that iterates over mappings that | |
translate the words in cipher_words to english words.""" | |
# no more cipher words to examine - return current mapping | |
if len(cipher_words) == 0: | |
yield mapping | |
return | |
# work with the first word |