목록프로그래밍 (72)
No Limitation
https://programmers.co.kr/learn/courses/30/lessons/42748?language=python3 코딩테스트 연습 - K번째수 [1, 5, 2, 6, 3, 7, 4] [[2, 5, 3], [4, 4, 1], [1, 7, 3]] [5, 6, 3] programmers.co.kr 가볍게 풀어본 구현 연습 def solution(array, commands): answer = []; answer = [sorted(array[com[0]-1:com[1]])[com[2]-1] for com in commands ] return answer Time complexity commands element 갯수 → n for 반복문 → O(n) 축약된 array의 길이 → m sorted..

https://programmers.co.kr/learn/courses/30/lessons/68644?language=python3 코딩테스트 연습 - 두 개 뽑아서 더하기 정수 배열 numbers가 주어집니다. numbers에서 서로 다른 인덱스에 있는 두 개의 수를 뽑아 더해서 만들 수 있는 모든 수를 배열에 오름차순으로 담아 return 하도록 solution 함수를 완성해주세요. 제한 programmers.co.kr Level1 두 개 뽑아서 더하기 문제 본 문제는 단순하게 for 반복문 2개를 사용하여 계산을 하고 요소가 있는 지 없는 지를 확인해주는 in method까지 사용할 경우 최악의 경우 O(n^3)까지 알고리즘이 증가하는 굉장히 비효율적인 알고리즘이다. def solution(numb..