728x90
https://school.programmers.co.kr/learn/courses/30/lessons/181898
📝 나의 풀이
using System;
public class Solution {
public int solution(int[] arr, int idx) {
int answer = -1;
for(int i=idx; i<arr.Length; i++){
if(arr[idx]<=arr[i] && arr[i]==1){
answer=i;
break;
}
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | C# | Lv.0] 문자열 출력하기 (0) | 2023.09.10 |
---|---|
[프로그래머스 | C# | Lv.0] 덧셈식 출력하기 (1) | 2023.09.09 |
[프로그래머스 | C# | Lv.0] x 사이의 개수 (0) | 2023.09.08 |
[프로그래머스 | C# | Lv.0] l로 만들기 (0) | 2023.09.07 |
[프로그래머스 | C# | Lv.0] 할 일 목록 (0) | 2023.09.07 |