python-algorithm
3285. Find Indices of Stable Mountains
무적김두칠
2024. 9. 21. 11:03
https://leetcode.com/problems/find-indices-of-stable-mountains/description/
1
2
3
4
5
6
7
8
|
class Solution:
def stableMountains(self, height: List[int], threshold: int) -> List[int]:
answer = []
for i in range(1, len(height)):
if height[i - 1] > threshold:
answer.append(i)
return answer
|
cs |
height 리스트를 순차 탐색하면서 바로 직전 값이 threshold보다 큰 경우 정답 리스트에 넣는 방식으로 구현
반응형