Created
February 4, 2019 17:48
-
-
Save Bennyelg/41aa2fe02c53bf5078b75b8258d68027 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
def get_lucky_version(real_floor: int): | |
floors: List[int] = [] | |
n = 1 | |
def its_a_bad_luck_floor(floor_no: int): | |
return "4" in str(floor_no) or "13" in str(floor_no) | |
for i in range(1, real_floor + 1): | |
if its_a_bad_luck_floor(n): | |
n += 1 | |
if its_a_bad_luck_floor(i): | |
n += 1 | |
floors.append(n) | |
n += 1 | |
return floors |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment