일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- 시스템 소프트웨어
- 자료형
- CS
- 이것이 취업을 위한 코딩테스트다
- 이것이 취업을 위한 코딩 테스트다
- 데이터통신
- 리스트
- icmp
- RARP
- OSI7계층모델
- 컴퓨터네트워크
- 북클럽
- 노개북
- ARP
- sort()
- DP
- 데이터 통신과 컴퓨터 네트워크
- 이코테
- 파이썬 자료형
- 파이썬 연산자
- 쉽게 배우는 데이터 통신과 컴퓨터 네트워크
- 쿠키
- 파이썬 정렬
- 컴퓨터 동작방식
- 노마드코더
- GIT
- IT5분잡학사전
- 라우팅
- 기억장치
- data type
- Today
- Total
목록Algorithm & Data structure/알고리즘 문제 풀이 (25)
뚝딱햄 탈출기
순열이란? 서로 다른 n개의 원소에서 r개를 중복없이 순서를 고려하여 선택하거나 나열하는 것. [1, 2, 3]에서 2개를 중복없이 순서를 고려하여 선택 및 나열한다면 [1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2] 이다. (조합은 순서를 고려하지 않고 선택 및 나열하는 것. 위와 같은 예시에서 조합을 구한다면 [1, 2], [1, 3], [2, 3]) JavaScript로 순열 구현하기 1. 선택할 원소 개수 r이 정해져 있을 때 ref: https://www.youtube.com/watch?v=0tcgYHU8IIs function permutate(arr) { const results = []; // DFS const dfs = (i, arr) => { // ba..
[프로그래머스][level 3] 베스트앨범 접근 방식 입력값이 두 배열 genres와 plays로 나뉘어 들어오지만, 두 배열의 같은 인덱스를 가진 값들은 하나의 노래에 대한 값이다. 따라서 한 객체에 노래에 대한 정보들을 모아야겠다고 생각했다. 먼저 Object에 노래의 고유번호(= 인덱스), 장르, 재생 횟수를 담는다. 반환값인 베스트앨범의 첫 번째 기준은 '속한 노래의 재생 횟수가 많은 장르 먼저 수록' 이므로 장르별로 해당 장르 노래들의 재생 횟수를 모두 더하고, 총 재생 횟수를 기준으로 장르를 내림차순 정렬해야겠다고 생각했다. 베스트앨범의 두 번째 기준은 '장르 내에서 많이 재생 횟수가 많은 노래 수록' 이다. 장르별로 속한 노래들을 재생 횟수를 기준으로 내림차순 정렬해야겠다고 생각했다. 장르를..
접근 방식 2024.03.02 - [Algorithm & Data structure/이론] - Dynamic Programming : DP, 동적 계획법, 다이나믹 프로그래밍 Dynamic Programming : DP, 동적 계획법, 다이나믹 프로그래밍 다이나믹 프로그래밍? 다이나믹 프로그래밍이란 하나의 문제를 단 한 번만 풀도록 하는 알고리즘이다. DP와 다르게 분할 정복은 동일한 문제를 다시 푼다. 예를 들어 피보나치 수열을 분할 정복 hyrmzz1.tistory.com 일단 하향식으로 코드를 작성해야겠다고 생각했다. 처음엔 메모이제이션을 위한 리스트를 아래 솔루션과는 다르게 별도로 만드려고 했는데 너무 복잡했다. 결국 1시간쯤 끄적이다 다른 분들의 솔루션을 보고 로직을 세웠다. 입력값을 담은 리스..
접근 방식 입력으로 주어진 M개의 수와 상근이가 가지고 있는 숫자 카드 중 일치하는 값이 있는지 순차적으로 확인한다. ❌ Solution 1 - 시간 초과 import sys n = int(sys.stdin.readline()) cards = list(map(int, sys.stdin.readline().split())) m = int(sys.stdin.readline()) num = list(map(int, sys.stdin.readline().split())) for i in num: if i in cards: print(1, end=" ") else: print(0, end=" ") 이 코드 내에서 시간이 오래 걸릴만한 부분은 if i in cards라고 생각했다. 찾아보니 리스트는 요소 하나하나를..