Skip to content

Instantly share code, notes, and snippets.

View DeviaVir's full-sized avatar
🏴‍☠️

Chase DeviaVir

🏴‍☠️
View GitHub Profile
"""
Delete Node at a given position in a linked list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
"""
Insert Node at a specific position in a linked list
head input could be None as well for empty list
Node is defined as
class Node(object):
def __init__(self, data=None, next_node=None):
self.data = data
self.next = next_node
C = raw_input()
M = raw_input()
C1 = int(C.split(' ')[0])
C2 = int(C.split(' ')[1])
ways = [1]+[0] * C1
for coin in M.split(' ')[:C2]:
coin = int(coin)
for i in range(coin, C1+1):
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
def main():
i = raw_input()
try:
N = int(raw_input())
for i in range(1, N + 1):
str = ''
if i % 3 == 0:
str = 'Fizz'
if i % 5 == 0:
str += 'Buzz'
if str == '':
str = i
open_symbols = ['(', '{', '[']
close_symbols = [')', '}', ']']
def main():
symbols = raw_input()
opened_once = False
open_list = []
close_list = []
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
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
class Node:
def __init__(self, data):
self.data = data
self.next = None
self.prev = None
class LinkedList:
def __init__(self):
self.root = None
def fib():
a, b = 0, 1
while True:
yield a
a, b = b, a + b
def main():
i = int(raw_input())
if i is 0: