Skip to content

Instantly share code, notes, and snippets.

@byronyi
Last active April 10, 2016 04:24
Show Gist options
  • Save byronyi/3adbaa5c051db79805b38d916f8f7360 to your computer and use it in GitHub Desktop.
Save byronyi/3adbaa5c051db79805b38d916f8f7360 to your computer and use it in GitHub Desktop.
from __future__ import division, print_function, unicode_literals
def counting_sheep(N):
'''
Code Jam 2016, Qualification Round, Problem A
'''
digits = set(range(10))
for i in range(1, int(1e6)):
number = i*N
digits.difference_update([int(x) for x in str(number)])
if not digits:
return number
return 'INSOMNIA'
def revenge_of_the_pancakes(pancakes):
'''
Code Jam 2016, Qualification Round, Problem B
'''
last_pancake = '+'
n_maneuver = 0
for pancake in reversed(pancakes):
if pancake == last_pancake:
pass
else:
n_maneuver += 1
last_pancake = pancake
return n_maneuver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment