[백준] 10818번 괄호 _ 문제 풀이
1. 문제
https://www.acmicpc.net/problem/10818
2. 풀이
input()
a = list(map(int, input().split()))
print("%d %d" % (min(a), max(a)))
[백준] 9012번 괄호 _ 문제 풀이
1. 문제
https://www.acmicpc.net/problem/9012
2. 풀이
2.1. 내 풀이
def solution(this):
arr = []
for x in this:
if x == '(':
arr.append(x)
else:
if len(arr) == 0:
return 'NO'
else:
arr.pop()
return 'YES' if len(arr) == 0 else 'NO'
total = int(input())
for...
[백준] 10773번 제로 _ 문제 풀이
1. 문제
https://www.acmicpc.net/problem/10773
3. 풀이
아래와 같이 배열을 사용하여 간단하게 해결할 수 있는 문제입니다.
arr = []
total = int(input())
for _ in range(total):
this = int(input())
if this == 0:
arr.pop()
else:
arr.append(this)
print(sum(arr))
[백준] 1003번 피보나치 함수 _ 문제 풀이
1. 문제
https://www.acmicpc.net/problem/1003
2. 풀이
2.1. 오답 풀이
처음에는 단순하게 재귀함수를 사용하여 문제를 해결하여 시간초과가 발생했다.
d= [0, 0]
def fibo(depth):
if depth == 0 or depth == 1:
d[depth] += 1
return
fibo(depth-1)
fibo(depth-2)
test_n = int(input())
for i in range(test_n):
d = [0, 0]
fibo(int(input()))
print('%d %d' % (d...
[프로그래머스] 정수 제곱근 판별 문제 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12934
2. 풀이
def solution(n):
return ((n ** 0.5) + 1) ** 2 if int(n ** 0.5) ** 2 == n else -1
[프로그래머스] 약수의 합 문제 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12928
2. 풀이
def solution(n):
aksoo = []
for i in range(1, n+1):
if n % i == 0:
aksoo.append(i)
return sum(aksoo)
[Solution] libgconf-2.so.4: cannot open shared object file: No such file or directory
1. Problem
When i use electron app, i see error. That error arise becuase of loading shared libraries: libgconf-2.so.4. There is no libarary.
usr@usr-ThinkPad-X1-Yoga-3rd:~/Desktop/RPi/balena-etcher-electron-1.4.9-linux-x64$ ./balena-etcher-electron-1.4.9-x86_64.AppImage
/tmp/.mount_TUl9n2/usr/bin/balena-etcher-electron: error while loading s...
[프로그래머스] Summer/Winter Coding(~2018) 영어 끝말잇기 문제 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12981
2. 풀이
def solution(n, words):
answer = []
used = {words[0]: True}
i = 1
while i < len(words):
# 사용 여부 체크
if words[i] in used:
return [i % n + 1, i // n + 1]
used[words[i]] = True
# 앞 단어 끝자리와 현 단어 앞자리 비교
if word...
[프로그래머스] 2018 KAKAO BLIND RECRUITMENT [1차] 다트 게임 문제 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/17682
2. 풀이
def solution(dartResult):
values = []
i = 0
while i < len(dartResult):
# 숫자 만들기
num = ''
while dartResult[i].isdecimal():
num += dartResult[i]
i += 1
num = int(num)
# 해당 숫자에 대한 보너스 확인
if ...
[프로그래머스] 이상한 문자 만들기 문제 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12930
2. 풀이
공백이 여러개 있는 것에 유의하여 문제를 해결하면 잘 해결됩니다. 공백을 하나로만 간주하여 시간이 꽤 소요되었습니다.
def solution(s):
answer = ''
cnt = 0
for x in s:
if x.isalpha():
answer += ( x.upper() if cnt % 2 == 0 else x.lower() )
cnt += 1
else:
answ...
864 post articles, 87 pages.