일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 배열파티션
- hoisting
- v-if
- 코어자바스크립트
- 우테코
- 10869번
- Python
- 2588번
- v-on
- 객체지향의 사실과 오해
- v-model
- 10926번
- 파이썬
- 3003번
- 쿠버네티스
- JavaScript
- 이벤트캡쳐링
- 실행 컨텍스트
- 도커
- 리스트복사
- 젠킨스
- v-for
- 백준
- MSA
- 이벤트버블링
- vue
- DevOps
- 프리코스
- LeetCode
- 빅오표기법
- Today
- Total
목록Algorithm/Leetcode (9)
새오의 개발 기록
연결 리스트를 입력받아 페어 단위로 스왑하라 Swap Nodes in Pairs - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com # 입력 예제 1->2->3->4 # 출력 예제 2->1->4->3 풀이 1. 반복 def swapPairs(self, head: Optional[ListNode]) -> Optional[ListNode]: dummy = ListNode(0, head) print(dummy) prev, curr = dummy, head while c..
배열을 입력받아 output[i]가 자신을 제외한 나머지 모든 요소의 곱셈 결과가 되도록 출력하라. *주의 나눗셈을 하지 않고 O(n)에 풀이하라 Product of Array Except Self - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com // 입력 예제 [1,2,3,4] // 출력 예제 [24,12,8,6] 오답 Time limit exceeded import math def productExceptSelf(self, nums: List[int]) -..
n개의 페어를 이용한 min(a,b)의 합으로 만들 수 있는 가장 큰 수를 출력하라. https://leetcode.com/problems/array-partition/ // 입력 예제 [1,4,3,2] // 출력 예제 4 //min(1,2) + min(3,4) = 4 풀이 1. 내림차순 풀이 페어의 min()의 합이 최대가 되려면 결국 min()이 최대한 커야 한다는 뜻이기 땜누에 내림차순으로 정렬한 뒤에 페어를 만들면 최대 min()페어를 유지할 수 있다. def arrayPairSum(self, nums: List[int]) -> int: # 내림 차순 정렬 nums.sort(reverse=True) sum = 0 # 큰 것끼리 묶어서 그 중 작은걸 골라야 가장 큰 값을 구할 수 있다. # [4,3..
덧셈하여 타겟을 만들 수 있는 배열의 두 숫자 인덱스를 리턴하라. Two Sum - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com # 입력 예제 num = [2, 7, 11, 15], target = 9 # 출력 예제 [0, 1] # 설명 # nums[0] + nums = 2 + 7 = 9 # 따라서 0, 1을 리턴한다. 풀이 1. 브루트 포스(무차별 대입)로 계산 단순히 푸는 방법 배열을 2번 반복하면서 모든 조합을 더해서 일일이 확인해보는 방법이다. 이 경우..