Skip to content

Commit 92ddde0

Browse files
committed
2022: Day 6 - Indentation & refactoring
1 parent d1c2e8b commit 92ddde0

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

2022/06/main.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ def part_one(self) -> int:
99
def part_two(self) -> int:
1010
return self.get_start_of_packet_marker(distinct_characters=14, input=self.puzzle_input)
1111

12-
@staticmethod
13-
def get_start_of_packet_marker(distinct_characters: int, input: list) -> int:
14-
for index, _ in enumerate(input):
15-
range = input[index:index + distinct_characters]
16-
17-
if len(set(range)) == len(range):
18-
return (index + distinct_characters)
12+
@staticmethod
13+
def get_start_of_packet_marker(distinct_characters: int, input: list) -> int:
14+
for index, _ in enumerate(input):
15+
if len(set(input[index:index + distinct_characters])) == distinct_characters:
16+
return (index + distinct_characters)
1917

2018
@staticmethod
2119
def load_input() -> list:

0 commit comments

Comments
 (0)