Spaces:
Sleeping
Sleeping
Download dataset/problem_2/buggy.py from Viraj0112/rl_code_fix_env: direct link, hf CLI and curl.
- Browser
- Download file 388 Bytes
-
https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_2/buggy.py
- Command line
-
hf download hf://spaces/Viraj0112/rl_code_fix_env/dataset/problem_2/buggy.py
-
curl -L -o buggy.py https://huggingface.co/spaces/Viraj0112/rl_code_fix_env/resolve/main/dataset/problem_2/buggy.py
388 Bytes
| def binary_search(nums: list[int], target: int) -> int: | |
| """Return index of target, or -1 if not found.""" | |
| left, right = 0, len(nums) - 1 | |
| while left < right: | |
| mid = (left + right) // 2 | |
| if nums[mid] == target: | |
| return mid | |
| if nums[mid] < target: | |
| left = mid + 1 | |
| else: | |
| right = mid - 1 | |
| return -1 | |