[파이썬🐍] 프로그래머스 : 네트워크
def solution(n, computers): answer = 0 visited = [False for i in range(n)] for com in range(n): if visited[com] == False: DFS(n,computers,com,visited) answer += 1 return answer def DFS(n,computers,com,visited): visited[com] = True for connect in range(n): if connect != com and computers[com][connect] == 1: if visited[connect] == False: DFS(n,computers, connect, visited) def solution(n, computers..
2021. 7. 17.
[파이썬🐍] 프로그래머스 : 숫자 문자열과 영단어
def solution(s): number = {"zero":"0","one":"1","two":"2","three":"3","four":"4","five":"5","six":"6","seven":"7","eight":"8","nine":"9"} for i in number: if i in s: s = s.replace(i, number[i]) return int(s)
2021. 7. 16.