본문으로 바로가기
728x90
반응형

문제

 

 

반응형

풀이

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
class Solution {
    public int searchInsert(int[] nums, int target) {
        for(int i=0; i<nums.length; i++) {
            if(nums[i] == target){
                return i;
            }else if(nums[i] > target){
                return i;
            }
        }
        return nums.length;
    }
}
cs

 

728x90
반응형