Python 8

[Codility] Lesson 7. Stacks and Queues - Fish (Python)

문제난이도: Easy상류와 하류로 향하는 물고기가 있고 각 물고기의 크기에 따라 잡아먹을 때, 남은 물고기의 수를 구하는 문제https://app.codility.com/programmers/lessons/7-stacks_and_queues/fish/ Fish coding task - Learn to Code - CodilityN voracious fish are moving along a river. Calculate how many fish are alive.app.codility.com 풀이def solution(A, B): N = len(A) down = [] alive = 0 for i in range(N): current_size = A[i] c..

[Codility] Lesson 6. Sorting - NumberOfDiscIntersections (Python)

문제난이도: Medium N개의 원들의 겹치는 개수를 구하는 문제https://app.codility.com/programmers/lessons/6-sorting/number_of_disc_intersections/ NumberOfDiscIntersections coding task - Learn to Code - CodilityCompute the number of intersections in a sequence of discs.app.codility.com 풀이def solution(A): n = len(A) result = 0 if n 10000000: return -1 return result 이 문제를 해결하기 위한 아이디어는 두 원의 중심 사이의 거리가 ..

[Codility] Lesson 5. Prefix Sums - MinAvgTwoSlice (Python)

문제난이도: Medium배열 A에서 A[P], A[Q] 사이의 값들의 평균을 구할때, 가장 작은 평균의 시작 위치 P를 반환https://app.codility.com/programmers/lessons/5-prefix_sums/min_avg_two_slice/ MinAvgTwoSlice coding task - Learn to Code - CodilityFind the minimal average of any slice containing at least two elements.app.codility.com 풀이def solution(A): l = len(A) min_avg = float('inf') min_index = 0 result = 0 for i in range(l-..

[Codility] Lesson 5. Prefix Sums - GenomicRangeQuery (Python)

문제난이도: Medium배열 P, Q가 주어졌을 때, M개의 쿼리 (P[K], Q[K])에 대해 S[P[K]:Q[K]])에 대한 가장 작은 impact factor 찾기. 단, 조건에 맞는 효율적인 방법으로 구현해야 함. 조건은 아래와 같음N is an integer within the range [1..100,000];M is an integer within the range [1..50,000];each element of arrays P and Q is an integer within the range [0..N - 1];P[K] ≤ Q[K], where 0 ≤ K string S consists only of upper-case English letters A, C, G, T.https://app..

[Codility] Lesson 4. Counting Elements - MissingInteger (Python)

문제난이도: Medium정수 배열 A가 주어지면 그 중 존재하지 않는 가장 작은 양의 정수를 반환하는 문제https://app.codility.com/programmers/lessons/4-counting_elements/missing_integer/ MissingInteger coding task - Learn to Code - CodilityFind the smallest positive integer that does not occur in a given sequence.app.codility.com 풀이def solution(A): # Implement your solution here A_set = set(A) i = 1 while i in A_set: i +=..

[Codility] Lesson 4. Counting Elements - MaxCounters (Python)

문제난이도: Medium N개의 카운터가 있고 주어진 배열 A에 따라 아래와 같은 기능을 할 때,increase(X) → A[K] = X (1 ≤ X ≤ N): X번째 카운터 값을 +1max counter → A[K] = N + 1: 모든 카운터 값을 현재 가장 큰 값으로 설정최종 카운터 상태를 배열로 반환하는 문제 https://app.codility.com/programmers/lessons/4-counting_elements/max_counters/ MaxCounters coding task - Learn to Code - CodilityCalculate the values of counters after applying all alternating operations: increase counte..

[Codility] Lesson 1. Iterations - BinaryGap (Python)

문제난이도: Easy이진수에서 1과 1 사이의 0의 최댓값을 구하는 문제https://app.codility.com/programmers/lessons/1-iterations/binary_gap/ BinaryGap coding task - Learn to Code - CodilityFind longest sequence of zeros in binary representation of an integer.app.codility.com 풀이def solution(N): binary = bin(N)[2:] current_gap = 0 max_gap = 0 counting = False for bit in binary: if bit == '1': ..

[Django] Django란?

Django란? Django는 Python 웹 프레임워크로, 2003년 로렌스 저널 월드 신문을 만들던 웹 개발팀의 내부 프로젝트로 시작해 2005년에 오픈소스 프로젝트로 공개되었다. Django는 웹사이트를 구축할 때 사용자 인증(회원가입, 로그인, 로그아웃 등)이나 관리자 패널, 폼, 파일 업로드와 같은 요소들을 제공해 개발자의 부담을 줄여준다. cf. 짧은 비화들- django 이름의 의미 : Django는 1930년대부터 1950대초까지 활동한 재즈 manouche 기타리스트 Django Reinhardt에서 따왔다고 한다. - django 발음에 대한 녹음 파일 : https://www.red-bean.com/~adrian/django_pronunciation.mp3 [출처]https://doc..

Programming 2024.08.12
반응형