웅재의 코딩세상
[프로그래머스] 첫 번째로 나오는 음수 본문
- 풀이
#include <string>
#include <vector>
using namespace std;
int solution(vector<int> num_list) {
int answer = 0;
for(int i=0; i<num_list.size(); i++){
if(num_list[i]<0) return i;
}
return -1;
}
반응형
'코딩테스트 > 프로그래머스 - LV 0' 카테고리의 다른 글
[프로그래머스] 이어 붙인 수 (0) | 2024.01.24 |
---|---|
[프로그래머스] 원소들의 곱과 합 (0) | 2024.01.23 |
[프로그래머스] 카운트 업 (0) | 2024.01.23 |
[프로그래머스] 문자열의 뒤의 n글자 (0) | 2024.01.23 |
[프로그래머스] n 번째 원소부터 (0) | 2024.01.23 |