본문 바로가기 메뉴 바로가기

B_log

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

B_log

검색하기 폼
  • 분류 전체보기 (311)
    • 알고리즘 학습 (174)
      • 알고리즘 개념 (8)
      • 프로그래머스 (48)
      • Codility (12)
      • 백준 알고리즘 (62)
      • 파이썬 알고리즘 인터뷰 (13)
      • 삼성 SWEA (20)
      • 종만북 with 파이썬 (5)
      • with Swift (1)
    • iOS 앱개발 (66)
      • Swift Basic (14)
      • iOS (33)
      • WWDC (6)
      • 암호화폐 거래소 앱 프로젝트 (6)
      • Daum Cafe 검색 앱 프로젝트 (5)
      • Swift GuideLines (2)
    • Web (29)
      • 개념 학습 (3)
      • Python | Django (18)
      • 우아한테크코스 (2)
      • AWS (2)
      • Java Script (4)
    • SQL 학습 (4)
      • 프로그래머스 SQL 문제풀이 (4)
    • 개발 독서 (15)
    • 개발 정보 (4)
    • 회고 (2)
    • 주식 (0)
      • 주식 독서 (0)
    • 제품 구매 후기 (2)
    • 이런 저런 생각들 (0)
  • 방명록

알고리즘 학습/Codility (12)
Codility - fish (Stacks and Queues) [Python]

문제 app.codility.com/programmers/lessons/7-stacks_and_queues/fish/ Fish coding task - Learn to Code - Codility N voracious fish are moving along a river. Calculate how many fish are alive. app.codility.com 문제 상황 - 물고기의 크기 리스트와 방향 리스트가 주어진다. 큰 물고기가 작은 물고기를 잡아먹고 최종적으로 살아남은 물고기의 수를 카운팅한다. 해결 전략 - 전체 물고기를 순회하며 주어진 조건을 연산한다. 상행 물고기들을 모을 스택을 만든다. 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 def solu..

알고리즘 학습/Codility 2020. 12. 31. 12:01
Codility - Brackets (Stacks and Queues) [Python]

문제 app.codility.com/programmers/lessons/7-stacks_and_queues/brackets/ Brackets coding task - Learn to Code - Codility Determine whether a given string of parentheses (multiple types) is properly nested. app.codility.com 문제 상황 - 전형적인 Stack 문제로 올바른 괄호 찾기 문제이다. 해결 전략 - 검색 속도가 빠른 dict를 이용해 짝을 구성하여 open bracket일 경우 stack에 저장, close bracket의 경우는 open bracket에서 pop하여 비교해서 같으면 제거, 다르면 잘못된 bracket이므로 ret..

알고리즘 학습/Codility 2020. 11. 7. 11:01
Codility - Triangle (Sorting) [Python]

문제 app.codility.com/programmers/lessons/6-sorting/triangle/ Triangle coding task - Learn to Code - Codility Determine whether a triangle can be built from a given set of edges. app.codility.com 문제 상황 - 주어진 배열을 삼각형 한 변 길이의 집합이라고 할 때 세 변으로 한개의 삼각형을 만들 수 있는 경우가 존재하면 1을 반환, 없으면 0을 반환한다. 해결 전략 코드 1 2 3 4 5 6 7 def solution(A): if len(A) A[i+2] : return 1 return 0 Colored by Color Scripter cs 해설 - 헷갈렸..

알고리즘 학습/Codility 2020. 11. 5. 11:54
Codility - NumberOfDiscIntersections (Sorting) [Python]

문제 app.codility.com/programmers/lessons/6-sorting/number_of_disc_intersections/ NumberOfDiscIntersections coding task - Learn to Code - Codility Compute the number of intersections in a sequence of discs. app.codility.com 문제 상황 - 주어진 배열의 인덱스는 각 원의 중심점을 의미한다. 즉, 인덱스 J 번째 원은 (J,0)을 중심으로 하는 원이다. 이 때 다른 원과 교차하는 원들의 쌍의 개수를 구한다. 문제의 조건에 안써있지만, 순서의 개념이 없어 1번 원, 3번 원의 쌍과 3번 원, 1번 원의 쌍은 같은 것으로 취급한다. 해결 전..

알고리즘 학습/Codility 2020. 11. 4. 16:04
Codility - Distinct [Python]

문제 app.codility.com/demo/results/trainingKZ7PTU-ND7/ Test results - Codility Write a function def solution(A) that, given an array A consisting of N integers, returns the number of distinct values in array A. For example, given array A consisting of six elements such that: A[0] = 2 A[1] = 1 A[2] = 1 A[3] = 2 A[4] = 3 A[5] = 1 the f app.codility.com 문제 상황 - 서로 다른 숫자의 종류 찾기 해결 전략 - set을 사용하면 쉽게 해결..

알고리즘 학습/Codility 2020. 9. 27. 15:06
Codility - PassingCars [Python]

문제 app.codility.com/programmers/lessons/5-prefix_sums/passing_cars/ PassingCars coding task - Learn to Code - Codility Count the number of passing cars on the road. app.codility.com 문제 상황 - 배열 A는 i번째에서 출발하는 차들의 이동 방향을 알려주는 배열이다. 즉, A[2] = 0 이면 2에서 출발하여 동쪽으로 이동하는 차라는 의미가 된다. 문제의 조건에 없지만 출발 시간은 동시라고 설정하고, 추월은 없다고 가정해야 문제가 성립한다. 해결 전략 1 - 결과적으로 1의 개수를 구하는 문제인데 구분점은 0이 된다. 즉, 어떤 서쪽으로 가는 차가 나왔을 때, 이 ..

알고리즘 학습/Codility 2020. 9. 27. 14:39
Codility - MinAvgTwoSlice [Python]

문제 app.codility.com/programmers/lessons/5-prefix_sums/min_avg_two_slice/ MinAvgTwoSlice coding task - Learn to Code - Codility Find the minimal average of any slice containing at least two elements. app.codility.com 문제 상황 - 주어진 리스트를 순회하며 부분 집합의 평균 중 최소가 되는 경우의 시작 인덱스를 출력한다. 해결 전략 - 수학적 지식이 필요한 문제이다. 어떤 두 수의 평균은 항상 작은 수보다 크고 큰 수보다 작다. 즉, 서로 다른 두 수 a, b(a

알고리즘 학습/Codility 2020. 9. 27. 13:52
Codility - CountDiv [Python]

😅 문제 🤔 문제 상황 - 문제의 범위가 너무 커서 단순히 O(N)으로 정의하면 안된다. 첫번째 풀이로는 O(B-A)인데 이는 최대 20억이 될 수 있으므로 시간 초과가 된다. 문제의 상황이 값 자체를 찾는 것이 아니라 개수를 찾는다는데 포인트를 잡아야 된다. 🧐 해결 전략 - divisable 여부를 찾는 것이므로 시작값과 끝 값으로 개수를 계산한다. 단, A가 K로 나눠 떨어지는지 여부에 따라 1개 차이가 날 수 있다. 🎰 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # O(B-A) def solution1(A, B, K): ret = 0 for dividend in range(A, B+1): if dividend % K == 0: ret += 1 return..

알고리즘 학습/Codility 2020. 8. 23. 16:58
이전 1 2 다음
이전 다음
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • 쿼드트리#BOJ#분할정복#Python
  • 반복수열#백준알고리즘#Python
  • API#lazy#
  • PassingCars#Codility#Python
  • 배열합치기#분할정복#BOJ#Python
  • django#slicing
  • 종이자르기#분할정복#BOJ#Python
  • django
  • 토마토#백준알고리즘#Python
  • 순열사이클#BOJ#Python
  • 랜선자르기#이분탐색#BOJ#Python
  • Triangle#Sorting#Codility#Python
  • N으로 표현#DP#Programmers#Python
  • 암호코드#dp#BOJ#Python
  • 리모컨#완전탐색#BOJ#Python
  • 날짜 계산#BOJ#완전탐색#Python
  • 병든 나이트#BOJ#탐욕법#Python
  • NumberofDiscIntersections#Codility#Sort#Python
  • 나무자르기#BOJ#이분탐색#Python
  • 백준 알고리즘#BackTracking
  • 미로 탐색#백준알고리즘#Python
  • 파이썬알고리즘인터뷰#4장
  • filter#isalnum#lower
  • 텀 프로젝트#백준알고리즘#Python
  • 공유기 설치#BOJ#이분탐색#Python
  • Brackets#Stacks and Queues#Codility#Python
  • 섬의개수#백준알고리즘#Python
  • Swift#Tuples#Range
  • Distinct#Codility#Python
  • 터틀비치#리콘#xbox#controller
more
«   2025/07   »
일 월 화 수 목 금 토
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 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바