일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- vue.js
- BFS
- kubernetes
- 오픈시프트
- jpa
- 머신러닝
- 리트코드
- Machine Learning
- POD
- 솔루션조사
- k8s
- 쿠버네티스
- 컨설턴트
- Redis
- 로깅
- vuejs
- 생성형 AI
- LeetCode
- fast api
- GPT
- 생성형
- OpenShift
- fastapi
- 도커
- LLaMa
- 메세지큐
- 컨설팅
- Python
- SpringBoot
- Docker
- Today
- Total
목록전체 글 (79)
수 많은 우문은 현답을 만든다
Trees: Is This a Binary Search Tree? 문제링크 Input Node List 가 들어온다. Output Yes (또는 No) 풀이: 더보기 def checkBST(root): // 검증할때는 함수를 하나 더 만들어야한다. def check(node, min_v, max_v): if node is None: return True //None이 아닌 True를 반환 if min_v >= node.data or max_v
Binary Search Tree : Lowest Common Ancestor 구하기 문제링크 Input 6 4 2 3 1 7 6 1 7 Output [reference to node 4] 풀이 : 더보기 def lca(root, v1, v2): if not root: return None // BST 특성상 작은게 루트의 왼쪽에 있다면 무조건 왼쪽 탐색 if v1 root.info: return lca(root.right, v1, v2) //찾고자 하는 두개 원소가 양쪽으로 있다고 한다면, 방향에 상관없이 어쨌든 바이너리 트리이자 최소점임 else: return root
Question : The height of a binary tree is the number of edges between the tree's root and its furthest leaf. For example, the following binary tree is of height 2 input : 3 5 2 1 4 6 7 result : 3 참조 : 원문링크 풀이 : 더보기 def height(root): if root is None: return -1 //0으로 하고 마지막에 맞춰도 된다. left_size = height(root.left) right_size = height(root.right) return 1 + max(left_size, right_size) //핵심은 방문시 +1을 높여..
Write a function that takes the binary representation of an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input will be given as a signed integer type. It should not affect your implementation, as the integer's internal binary representation is th..
Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. Example 1: Input: nums = [2,2,1] Output: 1 Example 2: Input: nums = [4,1,2,1,2] Output: 4 Example 3: Input: nums = [1] Output: 1 풀이 더보기 class Solution: def singleNumber(self, nums: List[int]) ..

문제 Given a binary tree, determine if it is height-balanced Example 1: Input: root = [3,9,20,null,null,15,7] Output: true Example 2: Input: root = [1,2,2,3,3,null,null,4,4] Output: false Example 3: Input: root = [] Output: true 풀이 더보기 class Solution: def isBalanced(self, root: Optional[TreeNode]) -> bool: def balance(node): if not node: return 0 left = balance(node.left) right = balance(node.righ..

Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Example 1: Input: root = [3,9,20,null,null,15,7] Output: 3 Example 2: Input: root = [1,null,2] Output: 2 풀이 더보기 if not root: return 0 left = self.maxDepth(root.left) right = self.maxDepth(root.right) return max(l..

Given the root of a binary tree, invert the tree, and return its root. Input: root = [4,2,7,1,3,6,9] Output: [4,7,2,9,6,3,1] Example 2: Input: root = [2,1,3] Output: [2,3,1] Example 3: Input: root = [] Output: [] 풀이 더보기 class Solution: def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]: if not root: return None left = self.invertTree(root.left) right = self.invertTree(root.righ..

문제 You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. Example 1: Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4] Example 2: Input: list1 = [], list2 = [] Output: [] Example 3: Input: list1 = [], list2 = ..
안녕하세요 조영호입니다. 오늘은 Transational 어노테이션을 사용하면서 발생했던 한 가지 문제에 대해서 공유하고자 합니다. @Transactional 이 선언된 하나의 메소드에서 내부적으로 3개의 메소드를 호출하고 있는 메소드에서 아래 오류가 발생했습니다. 오류내용 Aborted connection - Error enlisting in transaction - connection might be broken? Please check the logs for more information... - nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement: the XA resource has be..