
[99클럽] 코테 스터디 21일차 TIL - 이분탐색(35. Search Insert Position)
·
코딩 테스트/99클럽
문제문제 설명정렬된 nums[]와 target 정수가 주어진다.nums[] 배열에서 target 정수를 찾으면 반환하고찾지 못한다면 만약 target 정수가 nums[] 배열에 있다면 있어야 하는 index를 반환하라.시간 복잡도가 O(log n)인 알고리즘을 사용해야 한다.(이분탐색)예시Example 1:Input: nums = [1,3,5,6], target = 5Output: 2Example 2:Input: nums = [1,3,5,6], target = 2Output: 1Example 3:Input: nums = [1,3,5,6], target = 7Output: 4제약 조건1 -104 nums contains distinct values sorted in ascending order.-104 풀..