• Tomcat기동 시 JVM java security urandom 이슈

    Tomcat기동 시 JVM java security urandom 이슈 현상 Tomcat기동 시 1시간 이상 지연이 발생함(Windows 2014/ Tomcat 8) 원인 Linux서버는 Thread Pool 할당, Connection Pool 사용등에 난수값을 사용하는데, 이때 난수값을 가져오는데 /dev/random 디바이스를 사용함 Linux의 /dev 디렉토리는 시스템 디바이스 파일을 저장하는 디렉토리 예를들어 하드디스크는 /dev/sda, 씨디롬은 /dev/cdrom /dev/random은 랜덤 비트의 풀이며...


  • (LeetCode)787. K 경유지 내 가장 저렴한 항공권

    (LeetCode)787. K 경유지 내 가장 저렴한 항공권 문제 Cheapest Flights Within K Stops - LeetCode 아이디어 다익스트라 알고리즘 변형 코드 import heapq class Solution: def findCheapestPrice(self, n: int, flights: List[List[int]], src: int, dst: int, K: int) -> int: graph = collections.defaultdict(list) # 그래프 인접 리스트 구성 for u, v, w...


  • (LeetCode)743. 네트워크 딜레이 타임

    (LeetCode)743. 네트워크 딜레이 타임 문제 Network Delay Time - LeetCode 아이디어 다익스트라 알고리즘 적용 코드 import heapq class Solution: def networkDelayTime(self, times: List[List[int]], N: int, K: int) -> int: graph = collections.defaultdict(list) # 그래프 인접 리스트 구성 for u, v, w in times: graph[u].append((v, w)) # 큐 변수: [(소요 시간,...


  • (LeetCode)200. 섬의 개수

    (LeetCode)200. 섬의 개수 문제 Number of Islands - LeetCode 아이디어 dfs를 활용 코드 class Solution: def numIslands(self, grid: List[List[str]]) -> int: def dfs(i, j): if i<0 or i>=len(grid) or j<0 or j>= len(grid[0]) or grid[i][j] != '1': return grid[i][j] = 0 # 동서남북 탐색 dfs(i+1, j) dfs(i-1, j) dfs(i, j+1)...


  • (LeetCode)78.부분 집합

    (LeetCode)78.부분 집합 문제 Subsets - LeetCode 아이디어 트리의 DFS결과 출력 코드 class Solution: def subsets(self, nums: List[int]) -> List[List[int]]: result = [] def dfs(index, path): # 매번 결과 추가 result.append(path) print(index, path) print(result) # 경로를 만들면 DFS for i in range(index, len(nums)): dfs(i+1, path+[nums[i]]) dfs(0, []) return result