Python
Leetcode 704. Binary Search - Python 리트코드 비이너리 서치 파이썬
704. Binary Search Given an array of integers nums which is sorted in ascending order, and an integer target, write a function to search target in nums. If target exists, then return its index. Otherwise, return -1. You must write an algorithm with O(log n) runtime complexity. 주어진 배열은 정수의 오름차순이며 타겟하는 정수를 찾는 함수를 만들자. 타겟이 배열에 있으면 인덱스를 리턴하고 타겟이 배열에 없으면 -1 을 리턴하자. 주어진 문제 Example 1: Input: nums = [-1..
2022. 6. 9. 23:50