Coding Test

Coding Test

[Python] 프로그래머스 - 숫자 문자열과 영단어

문제https://school.programmers.co.kr/learn/courses/30/lessons/81301 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 해설Solution 1.해시를 이용하여 풀어보았다. hash_dict = { "zero": "0", "one": "1", "two": "2", "three": "3", "four": "4", "five": "5", "six": "6", "seven": "7", "eight": "8", "nine": "9",}def solution(s): answer = s for k, v in..

Coding Test

[Python] 프로그래머스 - 문자열 나누기

문제https://school.programmers.co.kr/learn/courses/30/lessons/140108 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 해설def solution(s): answer = [] reset = True for c in s: if reset: answer.append(c) matched = 0 unmatched = 0 reset = False if c == answer[-1]: matched = matched + 1 ..

Coding Test

[Python] 프로그래머스 - 크기가 작은 부분 문자열

문제https://school.programmers.co.kr/learn/courses/30/lessons/147355 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 해설슬라이딩 윈도우 사용이 핵심이었다. def solution(t, p): cnt = 0 for i in range(len(t) - (p_len := len(p)) + 1): if int(t[i: i + p_len])

Coding Test

[Python] 프로그래머스 - 문자열 내 p와 y의 개수

문제https://school.programmers.co.kr/learn/courses/30/lessons/12916 프로그래머스SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프programmers.co.kr 해설def solution(s): s = s.lower() return s.count('p') == s.count('y')

Coding Test

[C++] 백준 1065 - 한수

문제https://www.acmicpc.net/problem/1065 1065번: 한수어떤 양의 정수 X의 각 자리가 등차수열을 이룬다면, 그 수를 한수라고 한다. 등차수열은 연속된 두 개의 수의 차이가 일정한 수열을 말한다. N이 주어졌을 때, 1보다 크거나 같고, N보다 작거나www.acmicpc.net 해설1~99까지는 무조건 등차수열이 될 것이다. 비교할 3번째 항이 없기 때문이다. 100 이상은 각 자릿수를 분해하여 계산해 보면 된다. #include using namespace std;int hansu(int x) { int res = 0, th, h, t, n; for (int i = 1; i = 1000) { th = 1; h = int((i - th * 1000) / 100); ..

Coding Test

[Python] 백준 11721 - 열 개씩 끊어 출력하기

문제https://www.acmicpc.net/problem/11721 11721번: 열 개씩 끊어 출력하기첫째 줄에 단어가 주어진다. 단어는 알파벳 소문자와 대문자로만 이루어져 있으며, 길이는 100을 넘지 않는다. 길이가 0인 단어는 주어지지 않는다.www.acmicpc.net 해설txt = input()for i in range((len(txt) / 10).__ceil__()): print(txt[i * 10 : (i + 1) * 10])

loading