본문 바로가기

반응형

알고리즘/프로그래머스

(22)
프린터 12345678910111213141516171819202122232425262728293031#include #include using namespace std; int solution(vector priorities, int location) { int answer = 0; int size = priorities.size(); vector temp; for(int i = 0; i
H-Index 1234567891011121314151617181920212223242526#include #include #include using namespace std; int solution(vector citations) { int size = citations.size(); int zeroCount = 0; for(int i = 0; i = 0; i--) { int inclu = 0; for(int j = 0; j
쇠막대기 12345678910111213141516171819202122232425#include #include using namespace std; long solution(string arrangement) { long answer = 0; long lineCount = 0; for(int i = 0; i Int { let letters = arrangement.map() {String($0)} let length = letters.count var lineCount: Int = 0 var answer: Int = 0 for i in 0..
기능개발 123456789101112131415161718192021222324252627282930#include #include using namespace std; vector solution(vector progresses, vector speeds) { vector answer; vector temp; for(int i = 0; i
모의고사 1234567891011121314151617181920212223242526272829303132333435#include #include using namespace std; int sA[] = {1,2,3,4,5};int sB[] = {2,1,2,3,2,4,2,5};int sC[] = {3,3,1,1,2,2,4,4,5,5}; vector solution(vector answers) { vector answer; int nAnswers[3] = {0,}; for(int i = 0; i
완주하지 못한 선수 123456789101112131415161718192021#include #include #include using namespace std; string solution(vector participant, vector completion) { string answer = ""; sort(participant.begin(), participant.end()); sort(completion.begin(), completion.end()); int answerIdx; for(int i = 0, j = 0; i