Spaces:
Sleeping
Sleeping
Download dataset/problem_7/buggy.py from Viraj0112/rl_code_fix_env: direct link, hf CLI and curl.
- Browser
- Download file 356 Bytes
-
https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_7/buggy.py
- Command line
-
hf download hf://spaces/Viraj0112/rl_code_fix_env/dataset/problem_7/buggy.py
-
curl -L -o buggy.py https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_7/buggy.py
356 Bytes
| from collections import Counter | |
| def top_k_frequent(nums: list[int], k: int) -> list[int]: | |
| """Return k most frequent numbers, highest frequency first.""" | |
| freq = Counter(nums) | |
| # BUG: sorts by ascending frequency instead of descending. | |
| ordered = sorted(freq.items(), key=lambda item: item[1]) | |
| return [n for n, _ in ordered[:k]] | |