We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1ea779c commit 02d44c8Copy full SHA for 02d44c8
1 file changed
rounds/1_histogram/baseline.py
@@ -5,9 +5,10 @@
5
"""
6
7
from collections import Counter, deque
8
-from pathlib import Path
9
10
11
def compute_histogram(path: str) -> dict[bytes, int]:
12
"""Frequency of every 2-byte bigram in the file at ``path``."""
13
- return Counter(deque(Path(path).read_bytes(), maxlen=2))
+ with open(path, "rb") as f:
+ data = f.read()
14
+ return Counter(deque(data, maxlen=2))
0 commit comments