Last active
April 10, 2016 04:24
-
-
Save byronyi/3adbaa5c051db79805b38d916f8f7360 to your computer and use it in GitHub Desktop.
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
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