[Error solve] npm install error solve _ unable to verify the first certificate
1. Problem
You can meet SSL certificate problem problem on Company or private nework place. The error is like under text.
$ npm install --global --production windows-build-tools
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/windows-build-tools failed,...
[Error solve] git error _ SSL certificate problem
1. Problem
You can meet SSL certificate problem problem on Company or private nework place. The error is like under text.
$ git clone https://github.com/pynvme/pynvme
Cloning into 'pynvme'...
fatal: unable to access 'https://github.com/pynvme/pynvme/': SSL certificate problem: unable to get local issuer certificate
2. Solve
You can solve th...
[프로그래머스] 캐시 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/17680
2. 풀이
cash 역할을 하는 딕셔너리를 활용합니다.
딕셔너리에 있는 요소들 중에 가장 마지막에 사용한 요소를 찾아서 제거합니다.
def solution(cacheSize, cities):
if cacheSize == 0:
return len(cities)*5
cash = {}
answer = 0
cash_num = 0
for i in range(len(cities)):
if cities[i].lower() not in...
[프로그래머스] 실패율 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/42889
2. 풀이
2.1. lower_bound, upper_bound를 사용하여 해결한 풀이
먼저 배열을 정렬합니다. c++의 lower_bound, upper_bound 와 같은 함수로 bisect_left, bisect_right 함수가 존재합니다.
위의 함수들을 이용하여 찾고자 하는 숫자의 범위를 $ log(n) $ 의 효율성으로 구합니다.
최대 n 의 값에 대하여 위의 연산을 수행하기 때문에, $ n * log(\text{len(stages)}) $ 의 효율성을 가집니다.
imp...
[프로그래머스] 올바른 괄호 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12909
2. 풀이
def solution(s):
left = 0
for i, x in enumerate(s): # 모든 글자를 확인하면서 ( 보다 ) 가 많이 나온 경우에 False return
if x == '(':
left += 1
else:
left -= 1
if left < 0:
return False
if left !=...
[프로그래머스] 다음 큰 숫자 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12911
2. 풀이
def solution(n):
one_num = sum(list(map(int, bin(n)[2:]))) # 2진수로 변환한 뒤에 모든 숫자 더하기
while True:
n += 1
if one_num == sum(list(map(int, bin(n)[2:]))): # 1의 개수가 같으면 종료
return n
[프로그래머스] 프렌즈4블록 풀이_ 2018 KAKAO BLIND RECRUITMENT
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/17679
2. 풀이
시뮬레이션을 이용하여 풀면 되는 문제입니다.
상세 풀이는 주석을 통하여 정리하였습니다.
def solution(m, n, board):
new_board = [list(x) for x in board]
delete_list = []
while True:
# 4개 일치하는 영역 찾고 배열에 넣기
for r_idx in range(m - 1):
for c_idx in range(n - 1):
...
[프로그래머스] 뉴스 클러스터링 풀이 _ 2018 KAKAO BLIND RECRUITMENT
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/17677
2. 풀이
2.1. dictionary를 이용한 풀이
풀이에 해설에 대하여 주석으로 남겨보았습니다.
import math
def solution(str1, str2):
dic1 = {}; dic2 = {};
str_arr = [str1, str2]
dic_arr = [dic1, dic2]
for i in range(2):
for j in range(1, len(str_arr[i])): # 2글자씩 끊어서 만든 글자를 ...
[프로그래머스] 튜플 풀이 _ 2019 카카오 개발자 겨울 인턴십 문제
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12973
2. 풀이
문자열에서 숫자와 쉼표만 남기고 모두 제거합니다.
각 문자열을 돌면서 숫자와 쉼표의 조합인 경우에는 배열로 생성합니다.
딕셔너리(해쉬)를 이용하여 문자열의 존재 유무를 체크합니다.
import re
def solution(s):
answer = []
_s = re.split('[{}]', s[1:-1]) # 문자열에서 {} 를 모두 제거하고 숫자와 쉼표만 남김
arr = []
for x in _s: # 각 문자열을 돌면서 숫자와 ...
[프로그래머스] 짝지어 제거하기 풀이
1. 문제
https://programmers.co.kr/learn/courses/30/lessons/12973
2. 풀이
문자열을 idx를 하나씩 늘려가면서 stack에 top과 비교하는 아래의 과정을 반복합니다.
idx를 늘려가면서 문자열을 탐색하고 stack 맨 상위의 글자와 같은 경우에는 stack 에서 상위 글자를 제거하고,
아닌 경우에는 stack에 문자열을 넣어 줍니다.
def solution(s):
stk = [s[0]]
for i in range(1, len(s)):
if len(stk) == 0:
...
774 post articles, 78 pages.