Undergraduate/Programming
![[github] 관련 명령어](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcaqTAx%2FbtqNQa9bDid%2Fco7EtoAuJfFMGoCSDigFL0%2Fimg.png)
[github] 관련 명령어
먼저 github.com에서 레파지토리 생성 git init git add * git commit -m "message" git remote add origin 주소 git push origin master local repository : 내 로컬 컴퓨터 레파지토리 .git : 버전들이 저장됨 commit : 버전을 생성함 History : 버전에 대한 설명들이 들어있음 remote repository : 원격 저장소. 깃헙 서버에 있는 저장소. push origin : 내 컴터에서 원격저장소(github.com)로 전송함. pull : 원격저장소에서 내 컴터로 땡겨옴. 협업 방법: 작업->commit->push origin pull origin -> 작업 -> commit -> push->....
[python] enumerate 함수
enumerate는 “열거하다”라는 뜻(for문과 함께 자주 사용) 순서가 있는 자료형(list, set, tuple, dictionary, string)을 입력으로 받아 인덱스 값을 포함하는 enumerate 객체를 리턴함 list의 경우 순서와 list의 값을 전달하는 기능 # enumerate 함수 data = enumerate((1, 2, 3)) print(data, type(data)) for i, value in data: print(i, ":", value) print() data = enumerate({1, 2, 3}) for i, value in data: print(i, ":", value) print() data = enumerate([1, 2, 3]) for i, value in d..
[coding test] 2019 카카오 개발자 겨울 인턴십 문제
1,2,3번은 평이한 난이도라 코드만 keep. 10~20줄 내외다.(각 문제당 약 2~30분 동안 풀었음) 1.크레인 인형뽑기 게임 from collections import deque def solution(board, moves): leng = len(board) q = deque([]) count = 0 for i in moves: for j in range(leng): if board[j][i - 1] != 0: q.append(board[j][i - 1]) if len(q) >1 and q[len(q)-1]==q[len(q)-2]: count += 2 q.pop() q.pop() board[j][i - 1] = 0 break return count 2. 튜플 def solution(s): ss..
![[Python] 리스트(list)에서 '조합' 찾기(product,permutations,combinations)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FVQFyz%2FbtqDY2lTKrM%2FoPc4npOF2GmLnSBK6a1mu0%2Fimg.jpg)
[Python] 리스트(list)에서 '조합' 찾기(product,permutations,combinations)
알고리즘 문제에서 흔히 등장하는 조합을 찾는 문제. 여러 번 봤지만 볼 때마다 헷갈려서 정리해보려 한다. iteration은 설치가 필요 없는 파이썬의 기본 라이브러리 from itertools import product from itertools import permutations from itertools import combinations 다만 문제를 풀기 위해서는 순열(permutation)과 조합(combination)에 대한 이해가 있어야 하는데, 아래 블로그에 잘 정리되어 있다. https://suhak.tistory.com/2 순열(permutation)에서 조합(Combination)으로 순서가 있는 것에서 없는 것으로 경우의 수를 세는 방법 가운데 바탕이 되는 것은 순열과 조합이다. 그..