코테/프로그래머스 22

[프로그래머스/C++] 혼자서 하는 틱택토

문제https://school.programmers.co.kr/learn/courses/30/lessons/160585 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr   코드#include #include #include using namespace std;int dr[] = {1,0,1,1};int dc[] = {0,1,1,-1};int dfs(int r, int c, int depth, vector board, char ch, int idx){ if(depth==3) return 1; if(board[r][c]==ch){ ..

[프로그래머스/C++] 인사고과

문제https://school.programmers.co.kr/learn/courses/30/lessons/152995?language=cpp# 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  코드#include #include #include using namespace std;int cmp(vector a, vector b){ if(a[0]!=b[0]) return a[0]>b[0]; else return a[1]>b[1];}int solution(vector> scores) { int answer = 0; ..

[프로그래머스/C++] 과제 진행하기

문제https://school.programmers.co.kr/learn/courses/30/lessons/176962 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  코드#include #include #include #include using namespace std;int cmp(vectora, vectorb){ return a[1] solution(vector> plans) { vector answer; sort(plans.begin(), plans.end(), cmp); stack> s; int cur_time = stoi..

[프로그래머스/C++] 바탕화면 정리

문제https://school.programmers.co.kr/learn/courses/30/lessons/161990?language=cpp 프로그래머스코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.programmers.co.kr  코드#include #include using namespace std;vector solution(vector wallpaper) { vector answer; int min_x = 50, min_y=50, max_x=0, max_y=0; for(int i=0;i  풀이내 주제를 깨닫고 쉬운 문제를 풀었다.그림으로 보아도 알 수 있다시피 모든 파일을 전..

[프로그래머스/C#] 카드 뭉치

문제 https://school.programmers.co.kr/learn/courses/30/lessons/159994 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 using System; public class Solution { public string solution(string[] cards1, string[] cards2, string[] goal) { string answer = ""; int idx1 = 0; int idx2 = 0; for(int i=0;i

[프로그래머스/C#] N으로 표현

문제 https://school.programmers.co.kr/learn/courses/30/lessons/42895 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 using System; using System.Collections.Generic; public class Solution { public int solution(int N, int number) { int answer = 0; List dp = new List(); HashSet hs = new HashSet(); int temp = 0; for(int i=0;i

[프로그래머스/C#] 점프와 순간 이동

문제 https://school.programmers.co.kr/learn/courses/30/lessons/12980 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 오류났던 코드 using System; class Solution { const int MAXVALUE = 1000000001; int[] weight = new int[MAXVALUE]; bool[] visited = new bool[MAXVALUE]; public int solution(int n) { for(int i=0;i

[프로그래머스/C#] 괄호 회전하기

문제 https://school.programmers.co.kr/learn/courses/30/lessons/76502# 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 using System; using System.Collections.Generic; public class Solution { public int solution(string s) { int answer = 0; Dictionary d = new Dictionary(){{')', '('}, {']', '['}, {'}', '{'}}; int size = s.Length; for(in..

[프로그래머스/C++] 정수 삼각형

문제 https://school.programmers.co.kr/learn/courses/30/lessons/43105 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 위와 같은 삼각형의 꼭대기에서 바닥까지 이어지는 경로 중, 거쳐간 숫자의 합이 가장 큰 경우를 찾아보려고 합니다. 아래 칸으로 이동할 때는 대각선 방향으로 한 칸 오른쪽 또는 왼쪽으로만 이동 가능합니다. 예를 들어 3에서는 그 아래칸의 8 또는 1로만 이동이 가능합니다. 삼각형의 정보가 담긴 배열 triangle이 매개변수로 주어질 때, 거쳐간 숫자의 최댓값을 return 하도록 ..

[프로그래머스/C++] 구명보트

문제 https://school.programmers.co.kr/learn/courses/30/lessons/42885 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 코드 #include #include #include using namespace std; bool safe[500000]; int solution(vector people, int limit) { int answer = 0; sort(people.begin(), people.end(), greater()); int idx = people.size()-1; for(int i=0;i 남은 사람..