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
class Node: | |
def __init__(self, data): | |
self.data = data | |
self.next = None | |
self.prev = None | |
class LinkedList: | |
def __init__(self): | |
self.root = None |
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 fib(): | |
a, b = 0, 1 | |
while True: | |
yield a | |
a, b = b, a + b | |
def main(i=0): | |
if i is 0: | |
return 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
def main(): | |
values = map(int, raw_input().split(',')) | |
return reduce(lambda x, y: x ^ y, values) | |
print main() | |
# Because ^ (XOR) returns 0 for each pair and there is only one unpaired item in the input. | |
# E.g. | |
# 1 ^ 1 = 0 |
OlderNewer