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
반응형
'[JAVA] LeetCode > Easy' 카테고리의 다른 글
[LeetCode/릿코드] 66. Plus One (0) | 2023.01.24 |
---|---|
[LeetCode/릿코드] 58. Length of Last Word (0) | 2023.01.24 |
[LeetCode/릿코드] 27. Remove Element (0) | 2023.01.13 |
[LeetCode/릿코드] 26. Remove Duplicates from Sorted Array (0) | 2023.01.12 |
[LeetCode/릿코드] 14. Longest Common Prefix (0) | 2023.01.12 |