본문 바로가기

분류 전체보기698

[git] 원격 저장소(Github)에 파일 올리기 Github에 폴더 생성하기 git init 깃 활성화 git remote add origin '깃허브 주소' 깃허브의 원격 저장소의 위치를 저장 git add 폴더이름 폴더 올리기 git status 폴더 안에 올라갈 파일을 확인한다 (현재 깃 상태를 확인) git commit -m '커밋내용' 커밋 메세지를 남긴다 git push -u origin master 저장소에 파일 올리기 이미 원격소에 내용이 있는경우 git pull을 통해 내용을 업데이트 한 뒤 푸쉬해준다. 2021. 10. 20.
[git] 레포지토리(폴더) 이름 수정하기 git mv oldName new Name 아쉽게도 이전 커밋 기록은 유지되지만, 새로운 커밋 기록으로 덮어씌워집니다. (처음 폴더를 만들 때 신중하게 만들자) 2021. 10. 20.
[c++] 프로그래머스 - 게임 맵 최단거리 (Level 2) 문제 코딩테스트 연습 - 게임 맵 최단거리 [[1,0,1,1,1],[1,0,1,0,1],[1,0,1,1,1],[1,1,1,0,1],[0,0,0,0,1]] 11 [[1,0,1,1,1],[1,0,1,0,1],[1,0,1,1,1],[1,1,1,0,0],[0,0,0,0,1]] -1 programmers.co.kr 코드 #include #include #include using namespace std; int map[101][101]; int dx[4]={0,0,-1,1}; int dy[4]={-1,1,0,0}; int n1,n2; void bfs(int x,int y){ queueq; q.push({x,y}); while (!q.empty()) { int x=q.front().first; int y=q.fro.. 2021. 10. 19.
[c++] 프로그래머스 - 거리두기 확인하기 ( Level 2, 2021 카카오 인턴십) 코딩테스트 연습 - 거리두기 확인하기 [["POOOP", "OXXOX", "OPXPX", "OOXOX", "POXXP"], ["POOPX", "OXPXP", "PXXXO", "OXXXO", "OOOPP"], ["PXOPX", "OXOXP", "OXPOX", "OXXOP", "PXPOX"], ["OOOXX", "XOOOX", "OOOXX", "OXOOX", "OOOOO"], ["PXPXP", "XPXPX", "PXPXP", "XPXPX", "PXPXP"]] [1, 0, 1, 1, 1] programmers.co.kr #include #include #include using namespace std; int visited[6][6]; string map[6][6]; int dx[4]={0,0,-1,1}; .. 2021. 10. 19.
[c++] 프로그래머스 - 같은 숫자는 싫어 (Level 1) 코딩테스트 연습 - 같은 숫자는 싫어 배열 arr가 주어집니다. 배열 arr의 각 원소는 숫자 0부터 9까지로 이루어져 있습니다. 이때, 배열 arr에서 연속적으로 나타나는 숫자는 하나만 남기고 전부 제거하려고 합니다. 단, 제거된 후 남은 programmers.co.kr #include #include using namespace std; vector solution(vector arr){ vector answer; int flag=0; for(int i=0; i 2021. 10. 19.
[c++] 프로그래머스 - 가장 큰 수 (Level 2) 코딩테스트 연습 - 가장 큰 수 0 또는 양의 정수가 주어졌을 때, 정수를 이어 붙여 만들 수 있는 가장 큰 수를 알아내 주세요. 예를 들어, 주어진 정수가 [6, 10, 2]라면 [6102, 6210, 1062, 1026, 2610, 2106]를 만들 수 있고, 이중 가장 큰 programmers.co.kr #include #include #include using namespace std; bool cmp(string a, string b){ if(a.length()!=b.length()) return stoi(a+b)>stoi(b+a); else return stoi(a)>stoi(b); } string solution(vector numbers) { string answer = ""; vector.. 2021. 10. 19.
[c++] 프로그래머스 - [1차] 뉴스 클러스터링 ( Level 2, 2018 KAKAO BLIND RECRUITMENT ) 코딩테스트 연습 - [1차] 뉴스 클러스터링 뉴스 클러스터링 여러 언론사에서 쏟아지는 뉴스, 특히 속보성 뉴스를 보면 비슷비슷한 제목의 기사가 많아 정작 필요한 기사를 찾기가 어렵다. Daum 뉴스의 개발 업무를 맡게 된 신입사원 튜브 programmers.co.kr #include #include #include #include using namespace std; int solution(string str1, string str2) { int answer = 0; int sum=0,cnt=0; mapA,B,m; for(int i=0; i소문자 변경 str1[i]=tolower(str1[i]); } for(int i=0; i소문자 변경 str2[i]=tolower(str2[i]); } for(int i.. 2021. 10. 19.
[c++] 프로그래머스 - N개의 최소공배수 ( Level 2 ) 코딩테스트 연습 - N개의 최소공배수 두 수의 최소공배수(Least Common Multiple)란 입력된 두 수의 배수 중 공통이 되는 가장 작은 숫자를 의미합니다. 예를 들어 2와 7의 최소공배수는 14가 됩니다. 정의를 확장해서, n개의 수의 최소공배 programmers.co.kr #include #include #include using namespace std; long long int gcd(int a,int b){ if(b==0) return a; else return gcd(b,a%b); } int solution(vector arr) { int answer = 0; long long int gcd_value=1,lcm_value=1; if(arr.size()==1) lcm_value=a.. 2021. 10. 19.
[c++] 프로그래머스 - K번째 수 ( Level 1) 코딩테스트 연습 - K번째수 [1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3] programmers.co.kr #include #include #include using namespace std; vector solution(vector array, vector commands) { vector answer; for(int i=0; i 2021. 10. 19.