Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WEEK01: 배열, 문자열, 반복문과 재귀함수, 시간복잡도, 정렬, 완전탐색, 정수론 #12

Open
35 of 36 tasks
letsjo opened this issue Apr 7, 2023 · 0 comments
Assignees
Labels
STEP 단계

Comments

@letsjo
Copy link
Owner

letsjo commented Apr 7, 2023

단계 설명

배열, 문자열, 반복문과 재귀함수, 시간복잡도, 정렬, 완전탐색, 정수론

코드보기 / 문제

새로 알게된 점

  • List 정렬하는 방법
    sort()

     a = [3, 2, 8, 4, 1, 10, 99, 5]
     # 기본값 (오름차순)
     a.sort()	
     # [1, 2, 3, 4, 5, 8, 10, 99]
     
     a = [3, 2, 8, 4, 1, 10, 99, 5]
     # 오름차순
     a.sort(reverse=False) 
     # [1, 2, 3, 4, 5, 8, 10, 99]
     
     a = [3, 2, 8, 4, 1, 10, 99, 5]
     # 내림차순
     c.sort(reverse=True) 
     # [99, 10, 8, 5, 4, 3, 2, 1]
  • 순열 라이브러리 (permutations)
    순열이란, 몇 개를 골라 순서를 고려해 나열한 경우의 수를 말한다. 즉, 서로 다른 n 개 중 r 개를 골라 순서를 정해 나열하는 가짓수

     import itertools
     
     arr = ['A', 'B', 'C']
     nPr = itertools.permutations(arr, 2)
     print(list(nPr))
     
     # 결과 : [('A', 'B'), ('A', 'C'), ('B', 'A'), ('B', 'C'), ('C', 'A'), ('C', 'B')]
  • 조합 라이브러리 (combination)
    조합이란 서로 다른 n개 중에서 r개(n≥r) 취하여 조를 만들 때, 이 하나하나의 조를 n개 중에서 r개 취한 조합

     import itertools
     
     arr = ['A', 'B', 'C']
     nCr = itertools.combinations(arr, 2)
     print(list(nCr))
     
     # 결과 : [('A', 'B'), ('A', 'C'), ('B', 'C')]
@letsjo letsjo added the STEP 단계 label Apr 7, 2023
@letsjo letsjo self-assigned this Apr 7, 2023
@letsjo letsjo changed the title WEEK01. 크래프톤 정글 WEEK01. 배열, 문자열, 반복문과 재귀함수, 시간복잡도, 정렬, 완전탐색, 정수론 Apr 7, 2023
@letsjo letsjo changed the title WEEK01. 배열, 문자열, 반복문과 재귀함수, 시간복잡도, 정렬, 완전탐색, 정수론 WEEK01: 배열, 문자열, 반복문과 재귀함수, 시간복잡도, 정렬, 완전탐색, 정수론 Apr 7, 2023
letsjo added a commit that referenced this issue Apr 7, 2023
letsjo added a commit that referenced this issue Apr 7, 2023
letsjo added a commit that referenced this issue Apr 7, 2023
letsjo added a commit that referenced this issue Apr 8, 2023
letsjo added a commit that referenced this issue Apr 8, 2023
letsjo added a commit that referenced this issue Apr 8, 2023
letsjo added a commit that referenced this issue Apr 8, 2023
letsjo added a commit that referenced this issue Apr 8, 2023
재귀함수 로 로직 변경
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 10, 2023
letsjo added a commit that referenced this issue Apr 11, 2023
letsjo added a commit that referenced this issue Apr 11, 2023
letsjo added a commit that referenced this issue Apr 11, 2023
조합 라이브러리 사용
letsjo added a commit that referenced this issue Apr 11, 2023
순열 라이브러리 사용
letsjo added a commit that referenced this issue Apr 12, 2023
letsjo added a commit that referenced this issue Apr 12, 2023
letsjo added a commit that referenced this issue Apr 12, 2023
재귀함수 return 조건 수정
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
STEP 단계
Projects
None yet
Development

No branches or pull requests

1 participant