binary search1 [Algorithm][Recursion] 문제 풀이 #21 - Binary Search 문제 링크 https://leetcode.com/problems/binary-search/ 풀이 public int search(int[] nums, int target) { int start = 0; int end = nums.length - 1; while(start nums[mid]) start = mid + 1; else return mid; } return -1; } 결과 이진 검색을 사용해서 쉽게 풀수 있었다. 역시 easy는 easy 2022. 8. 6. 이전 1 다음