일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- k8s
- vuejs
- android
- Flutter
- DFS와BFS
- DFS
- 분할정복
- 코딩테스트
- C++
- 동적계획법
- 파이썬
- django
- BAEKJOON
- 백준
- Python
- issue
- 코테
- cos pro
- 안드로이드
- 알고리즘
- 안드로이드스튜디오
- cos pro 1급
- 동적계획법과최단거리역추적
- codingtest
- cos
- DART
- Algorithm
- 코드품앗이
- 개발
- AndroidStudio
- Today
- Total
목록codingtest (62)
Development Artist

문제 유형 한줄 수정 난이도 normal Note 1. 2차 10번 0들을 0으로 만들기와 로직 유사. 차이점 찾기(previous) Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 4차 2번 def solution(s): s = s.lower() answer = "" previous = s[0] counter = 1 for alphabet in s[1:]: if alphabet == previous: counter += 1 else: answer += previous + str(counter) counter = 1 previous = alphabet answer += previous + str(counter) return answer..

문제 유형 한줄 수정 난이도 normal Note 1. recursive 함수, create_words 로직 암기. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 4차 1번 words = [] def create_words(lev, s): global words VOWELS = ['A', 'E', 'I', 'O', 'U'] words.append(s) for i in range(0, 5): if lev < 5: create_words(lev+1, s + VOWELS[i]) def solution(word): global words words = [] answer = 0 create_words(0, '') for idx, i in en..

문제 유형 빈칸 난이도 easy Note 1. 파이썬의 Class, def, self Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean class Customer: def __init__(self, id, time, num_of_people): self.id = id self.time = time self.num_of_people = num_of_people class Shop: def __init__(self): self.reserve_list = [] def reserve(self, customer): self.reserve_list.append(customer) return True class HairShop(Shop): def __i..

문제 유형 한줄 수정 난이도 easy Note Nothing Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean def solution(revenue, k) : answer = 0 rsum = sum(revenue[0:k]) answer = rsum for i in range(len(revenue)) : rsum = sum(revenue[i:k+i]) if answer < rsum : answer = rsum return answer revenue1 = [1, 1, 9, 3, 7, 6, 5, 10] k1 = 4 ret1 = solution(revenue1, k1) print("solution 함수의 반환 값은", ret1, "입니다.") re..

문제 유형 한줄 수정 난이도 easy Note Nothing Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean def solution(k, student): answer = 0 for s in student: s -= 4*k if s

문제 유형 한줄 수정 난이도 easy Note 1. 카프리카 수 : 자신의 제곱수를 둘로 나눠 더한 값이 자기 자신 ( 단, 둘로 나뉜 수는 양수 ) ex ) 55 -> 55^2 = 3025 -> 30+25 = 55 2. 코딩 유형으로 나온다면, divisor를 사용한다는 것만 떠올리면 될 듯. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean def solution(k): answer = [] for i in range(1, k + 1): square_num = i * i divisor = 1 while square_num // divisor != 0: front = square_num // divisor back = square_num ..

문제 유형 빈칸 난이도 normal Note 1. 빈칸 유형이라서 난이도는 쉬움. 2. 하지만, 첫번째 for문에서 소수 리스트를 만드는 부분의 로직은 암기 필요! 절대절대절대 중요. '에라토스테네스의 체' 라는 유명한 개념이 사용됨. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 3차 6번 def solution(n): answer = 0 primes = [2] for i in range (3, n + 1, 2) : is_prime = True for j in range(2, i) : if i % j == 0 : is_prime = False break if is_prime : primes.append(i) prime_len = l..

문제 유형 코딩 난이도 normal Note 1. 나타날때, 사라질때를 구별해서 구현. second: dist = plen-second front = '' for _ in range(dist): front += '_' return front+phrases[0:second] else: dis = second - plen back = '' for _ in range(dist): back += '_' return phrases[dis:]+back ※ 가끔 코드 중 print(~)가 있습니다. 정리 못한 점 죄송합니다.

문제 유형 코딩 난이도 easy Note 1. for문 2개로 나눈 이유. 2. 배열 s1[-i:] 의 의미. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 3차 4번 def solution(s1, s2): answer = 0 for i in range(len(s1)): if s1[0:i] == s2[-i:]: print(s1[0:i]) answer = i break for i in range(len(s2)): if s2[0:i] == s1[-i:]: print(s2[0:i]) if answer < i: answer = i break return len(s1)+len(s2)-answer s1 = "ababc" s2 = "abcdab"..

문제 유형 코딩 난이도 hard Note 1. bfs문제 유형. '순회'라는 개념. dxy : 비숍이 갈 수 있는 좌표를 설정. Code # -*- coding: utf-8 -*- # UTF-8 encoding when using korean # 3차 3번 def solution(bishops): answer = 0 dxy = [[1,1],[1,-1],[-1,1],[-1,-1]] field = [[0] * 8 for i in range(8)] for bis in bishops: x = ord(bis[0])-65 y = int(bis[1])-1 field[x][y] = 1 for dx, dy in dxy: nx , ny = x, y while True: nx += dx ny += dy if nx >=8 o..