이진 탐색

알고리즘

[LeetCode] 162 Find Peak Element JavaScript

문제 링크 Find Peak Element - LeetCode 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 문제 유형 이진 탐색 (Binary Search) 문제 풀이 이 문제는 완전 탐색을 통해 배열 내의 가장 큰 값을 찾고, 전/후 값을 비교해 peak elements인지 확인하는 방법이 있다. 이 경우, 시간 복잡도는 O(n)이다. 이 문제는 O(log n)의 시간복잡도를 갖도록 구현해야 하므로 이진 탐색을 이용하여 peak elements를 찾는다면 O(log n)의 ..

sandwe
'이진 탐색' 태그의 글 목록