PS (Problem Solving)

PS (Problem Solving)/Programmers

[프로그래머스] 약수 구하기 - 파이썬

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120897 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 def solution(n): answer = [] for num in range(1, n+1): if n % num == 0: answer.append(num) return answer

PS (Problem Solving)/Programmers

[프로그래머스] 가장 큰 수 찾기 - 파이썬, 자바스크립트

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120899 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 파이썬 def solution(array): answer = [] answer.append(max(array)) index = array.index(max(array))# max index 구하기 answer.append(index) return answer 자바스크립트 - max값을 구할 때 스프레드 문법으로 풀어줘야 한다. 안그러면 NaN이 발생한다. function solutio..

PS (Problem Solving)/Programmers

[프로그래머스] 옹알이 (1) - 파이썬

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120956 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 - 순열 조합으로 새로운 data list를 만든 후 babbling의 단어들과 비교, 일치하면 발음할 수 있다. from itertools import permutations def solution(babbling): text = ["aya", "ye", "woo", "ma"] word = list(permutations(text)) for x in range(4): # 4가지 단어..

PS (Problem Solving)/Programmers

[프로그래머스] 배열의 유사도 - 파이썬

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120903 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 def solution(s1, s2): answer = 0 for i in range(len(s1)): if s1[i] in s2: answer += 1 return answer

PS (Problem Solving)/SW Expert Academy

[SWEA] 15230. 알파벳 공부 - 파이썬

문제 https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AYLnMQT6vPADFATf SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com 설계 - 알파벳 순서대로 비교, index error 조심 T = int(input()) for TC in range(1, T + 1): alphabet = 'abcdefghijklmnopqrstuvwxyz' arr = input() answer = 0 N = min(len(alphabet), len(arr)) # index error 방지 for i in range(N): if alphabe..

PS (Problem Solving)/Programmers

[프로그래머스] 문자열 계산하기 - 파이썬

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120902 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 def solution(my_string): cal, index = [], -2 # 빈칸(' ') 처리를 위해 index 2단위 설정 # 숫자 및 연산자 파싱 for i in range(len(my_string)): if my_string[i] == '+': cal.append(int(my_string[index + 2:i - 1])) cal.append('+') index = i e..

PS (Problem Solving)/Programmers

[프로그래머스] 문자열 뒤집기 - 파이썬, 자바스크립트

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120822 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 파이썬 def solution(my_string): N = len(my_string) // 2 my_string = list(my_string) for i in range(N): my_string[i], my_string[-1-i] = my_string[-1-i], my_string[i] answer = '' for i in range(len(my_string)): answer += ..

PS (Problem Solving)/Programmers

[프로그래머스] 삼각형의 완성조건 (1) - 파이썬

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120889 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 def solution(sides): sides.sort() if sides[0] + sides[1] > sides[2]: return 1 return 2

PS (Problem Solving)/Programmers

[프로그래머스] 최댓값 만들기 (1) - 파이썬, 자바스크립트

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120847 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 파이썬 def solution(numbers): numbers.sort() return numbers[-1] * numbers[-2] 자바스크립트 function solution(numbers) { const max1 = Math.max(...numbers) const index1 = numbers.indexOf(max1) numbers[index1] = 0 const max2 = M..

PS (Problem Solving)/Programmers

[프로그래머스] 문자 반복 출력하기 - 파이썬, 자바스크립트

문제 https://school.programmers.co.kr/learn/courses/30/lessons/120825 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 설계 파이썬 def solution(my_string, n): answer = '' for i in range(len(my_string)): for _ in range(n): answer += my_string[i] return answer 자바스크립트 function solution(my_string, n) { let answer = '' for (let i = 0; i < my_stri..

캐럿노트
'PS (Problem Solving)' 카테고리의 글 목록 (5 Page)