[Level 1] / [Python] 콜라츠 추측
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12943 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(num): answer = 0 count = 0 while num != 1: if num%2 == 0: num = num//2 count += 1 else: num = (num * 3) + 1 count += 1 if count > 500: return -1 answer = count return answer
[Level 1] / [Python] 나머지가 1이 되는 수 찾기
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/87389 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(n): answer = 0 m = n - 1 for i in range(2, m+1): if m % i == 0: return i
[Level 1] / [Python] x만큼 간격이 있는 n개의 숫자
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12954 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(x, n): answer = [] sum = 0 for i in range(n): sum += x answer.append(sum) return answer
[Level 1] / [Python] 정수 내림차순으로 배치하기
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12933 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(n): answer = [] s = str(n) for i in s: answer.append(i) answer = sorted(answer, reverse=True) answer = ''.join(answer) return int(answer)
[Level 1] / [Python] 문자열을 정수로 바꾸기
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12925 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(s): answer = 0 answer = int(s) return answer
[Level 1] / [Python] 하샤드 수
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12947 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(x): answer = True x = str(x) sum = 0 for i in x: sum += int(i) if int(x)%sum == 0: return answer else: return False
[Level 1] / [Python] 문자열 내 p와 y의 개수
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12916 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(s): answer = True countp=0 county=0 for i in range(len(s)): if s[i] == 'p' or s[i] =='P': countp += 1 elif s[i] == 'y' or s[i] == 'Y': county += 1 if countp == 0 and county ==0: return True else: if countp == c..
[Level 1] / [Python] 정수 제곱근 판별
·
Coding Test/프로그래머스
https://school.programmers.co.kr/learn/courses/30/lessons/12934 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr def solution(n): answer=0 m = n//2 if n == 1: return 4 for i in range(2,m): if pow(i,2) == n: answer = pow(i+1,2) return answer return -1
욱근욱
개미는 오늘도 열심히 일을하네