LeetCode - The World's Leading Online Programming Learning Platform
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
문제
int형 배열 nums가 오름차순으로 정렬되어있고 (1~n)번 회전하였습니다. 이때 nums의 가장 최솟값을 반환하는 문제입니다.
풀이
파이썬에선 역시 min()함수를 이용하여 쉽게 해결할 수 있습니다.
class Solution:
def findMin(self, nums: List[int]) -> int:
return min(nums)
'자료구조,알고리즘' 카테고리의 다른 글
LeetCode-530 Minimum Absolute Difference in BST 자바 풀이 (0) | 2023.09.08 |
---|---|
LeetCode-230 Kth Smallest Element in a BST 자바 풀이 (0) | 2023.09.08 |
LeetCode-33 Search in Rotated Sorted Array 파이썬 풀이 (0) | 2023.09.05 |
LeetCode-162 Find Peak Element 파이썬 풀이 (0) | 2023.09.05 |
LeetCode-148 Sort List 파이썬 풀이 (0) | 2023.09.05 |