Download 141/solution/_reference.py from PRHW/loom-benchmark-mbpp: direct link, hf CLI and curl.
- Browser
- Download file 266 Bytes
-
https://huggingface.co/datasets/PRHW/loom-benchmark-mbpp/resolve/main/141/solution/_reference.py
- Command line
-
hf download hf://datasets/PRHW/loom-benchmark-mbpp/141/solution/_reference.py
-
curl -L -o _reference.py https://huggingface.co/datasets/PRHW/loom-benchmark-mbpp/resolve/main/141/solution/_reference.py
266 Bytes
| def pancake_sort(nums): | |
| arr_len = len(nums) | |
| while arr_len > 1: | |
| mi = nums.index(max(nums[0:arr_len])) | |
| nums = nums[mi::-1] + nums[mi+1:len(nums)] | |
| nums = nums[arr_len-1::-1] + nums[arr_len:len(nums)] | |
| arr_len -= 1 | |
| return nums |