소스 검색

Solve day 6

Taddeus Kroes 3 년 전
부모
커밋
6dc283f250
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      2022/06_packets.py
  2. 0 0
      2022/input/6

+ 15 - 0
2022/06_packets.py

@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+import sys
+from collections import Counter, deque
+
+def marker(stream, winlen):
+    window = deque(stream[:winlen - 1])
+    for i, char in enumerate(stream[winlen - 1:]):
+        if char not in window and len(Counter(window)) == winlen - 1:
+            return i + winlen
+        window.popleft()
+        window.append(char)
+
+stream = sys.stdin.readline().rstrip()
+print(marker(stream, 4))
+print(marker(stream, 14))

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
2022/input/6


이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.