| 模型 | 模型答案 | 正确答案 |
|---|---|---|
| 金声玉亮2.0 | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| deepseek-r1 | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] n = len(mountain) for i in range(1, n - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| gpto1 | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| gpt-4o-2024-08-06 | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| DeepSeek-Coder-V2-Lite-Instruct | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| Meta-Llama-3.1-405B-Instruct-Turbo | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| Meta-Llama-3.1-70B-Instruct-Turbo | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| Qwen2-72B-Instruct | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i-1] and mountain[i] > mountain[i+1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| baichuan4 | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| doubao | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: result = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: result.append(i) return result ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| gpto1 | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| kimi | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| minimax | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: n = len(mountain) peaks = [] # Find peaks from left to right for i in range(1, n - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| wenxinyiyan | ```python from typing import List class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] n = len(mountain) for i in range(1, n-1): if mountain[i] > mountain[i-1] and mountain[i] > mountain[i+1]: peaks.append(i) return peaks ``` Explanation: * The `findPeaks` function takes a list `mountain` as input and returns a list of indices representing the peaks in the mountain. * We initialize an empty list `peaks` to store the indices of the peaks. * We iterate over the elements of the `mountain` list from index 1 to `n-2` (where `n` is the length of the list). We exclude the first and last elements since they cannot be peaks according to the problem specification. * For each element at index `i`, we check if it is strictly greater than both its neighboring elements `mountain[i-1]` and `mountain[i+1]`. If it is, then we add the index `i` to the `peaks` list. * Finally, we return the `peaks` list containing the indices of the peaks in the mountain. |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| zhipu | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] for i in range(1, len(mountain) - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |
| deepseek-v3 | ```python class Solution: def findPeaks(self, mountain: List[int]) -> List[int]: peaks = [] n = len(mountain) for i in range(1, n - 1): if mountain[i] > mountain[i - 1] and mountain[i] > mountain[i + 1]: peaks.append(i) return peaks ``` |
[{"input": "[2, 4, 4]", "output": "[]", "testtype": "functional"}, {"input": "[1, 4, 3, 8, 5]", "output": "[1, 3]", "testtype": "functional"}] |