코딩테스트/프로그래머스 - LV 0
[프로그래머스] 첫 번째로 나오는 음수
웅드
2024. 1. 23. 15:27
- 풀이
#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;
}
반응형