Download 10-week-algorithm-excercise-master/Week_09/344/reverse_string.py from Dorothydu/gitrepo_20: direct link, hf CLI and curl.
- Browser
- Download file 312 Bytes
-
https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/10-week-algorithm-excercise-master/Week_09/344/reverse_string.py
- Command line
-
hf download hf://datasets/Dorothydu/gitrepo_20/10-week-algorithm-excercise-master/Week_09/344/reverse_string.py
-
curl -L -o reverse_string.py https://huggingface.co/datasets/Dorothydu/gitrepo_20/resolve/main/10-week-algorithm-excercise-master/Week_09/344/reverse_string.py
312 Bytes
| from typing import List | |
| class Solution: | |
| def reverseString(self, s: List[str]) -> None: | |
| """ | |
| Do not return anything, modify s in-place instead. | |
| """ | |
| i, j = 0, len(s)-1 | |
| while i < j: | |
| s[i], s[j] = s[j], s[i] | |
| i += 1 | |
| j -= 1 | |
| return s |