본문 바로가기

전체 글

(14)
[알고리즘] 배열-배열 파티션 I - Jungyu Ko 문제 출처 Array Partition I - 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 문제 설명 n개의 페어를 이용한 min(a, b)의 합으로 만들 수 있는 가장 큰 수를 출력하라. 문제 풀이 class Solution: def arrayPairSum(self, nums: List[int]) -> int: sorted_nums = sorted(nums) # 입력 배열을 정렬 ans = 0 # 정답 ans 초기값 설정 for i in range(0, le..
[알고리즘] 배열-세 수의 합 - Jungyu Ko 문제 출처 3Sum - 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 문제 설명 배열을 입력받아 합으로 0을 만들 수 있는 3개의 엘리먼트를 출력하라. 문제 풀이 브루트포스 방법으로 문제를 풀면 시간초과 발생... ### 브루트포스 1 class Solution: def threeSum(self, nums: List[int]) -> List[List[int]]: ans = [] # 정답 nums = sorted(nums) # sorting! for i in ra..
[알고리즘] 배열-빗물 트래핑 - Jungyu Ko 문제 출처 Trapping Rain Water - 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 문제 설명 높이를 입력받아 비 온 후 얼마나 많은 물이 쌓일 수 있는지 계산하라. 문제 풀이 class Solution: def trap(self, height: List[int]) -> int: empty_size = [] if len(height)
[알고리즘] 배열-두 수의 합 - Jungyu Ko 문제 출처 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 문제 설명 덧셈하여 타겟을 만들 수 있는 배열의 두 숫자 인덱스를 리턴하라. 문제 풀이 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: ans = [] for i in range(len(nums)-1): # 처음부터 마지막 바로 전까지 반북 for j in range(i+1, len(nums)): #..
[Info] 2022 청년취업지원금 - Jungyu Ko 2022년 취업을 준비하고 있습니다. 서울시에서 지원하는 2022 청년취업지원금 신청방법에 대해 알아보겠습니다. 아래 사이트에서 서울시 청년수당 지원에 대해 알아봅시다. 청년정책 상세 www.youthcenter.go.kr 일단 한번 신청해보고 되면 좋고 안되면 아쉬운거니까 지원해봅시다! 제출 서류 신청하기 앞서, 원활한 진행을 위해 2가지 서류를 준비합니다. 최종학교(고교, 대학, 대학원) 졸업증명서(또는 수료증) 1부 졸업 날짜를 명확히 확인할 수 있는 서류여야하며, 공고일 이후 발급된 서류여야 합니다. 민원24(http://www.minwon.go.kr) 또는 각 대학,대학원에서 온라인으로 발급할 수 있습니다. 근로계약서 (단기근로자만 제출) 고용보험에 가입된 단기근로자의 경우 근로계약서 미제출자는..
[알고리즘] 문자열 조작-그룹 애너그램 - Jungyu Ko 문제 출처 Group Anagrams - 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 문제 설명 문자열 배열을 받아 애너그램 단위로 그룹핑하라. '애너그램'이란? 일종의 언어유희로 문자를 재배열하여 다른 뜻을 가진 단어로 바꾸는 것을 말한다. '어구전철'이라고도 부르며, 과거 유럽에서는 근대까지 이러한 언어유희가 매우 유행했다고 한다. 애너그램의 우리말 예로는, '문전박대'를 '대박전문'으로 바꿔 부르는 단어 등을 들 수 있다. 문제 풀이 애너그램을 판단하는 ..
[알고리즘] 문자열 조작-가장 흔한 단어 - Jungyu Ko 문제 출처 Most Common Word - 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 문제 설명 금지된 단어를 제외한 가장 흔하게 등장하는 단어를 출력하라. 대소문자 구분을 하지 않으며, 구두점(마침표, 쉼표 등) 또한 무시한다. 문제 풀이 class Solution: def mostCommonWord(self, paragraph: str, banned: List[str]) -> str: lowers = paragraph.lower() # 입력 문자열을 소..
[알고리즘] 문자열조작-로그파일 재정렬 - Jungyu Ko 문제 출처 https://leetcode.com/problems/reorder-data-in-log-files/ Reorder Data in Log Files - 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 문제 설명 로그를 재정렬하라. 기준은 다음과 같다. 로그의 가장 앞 부분은 식별자다. 문자로 구성된 로그가 숫자 로그보다 앞에 온다. 식별자는 순서에 영향을 끼치지 않지만, 문자가 동일할 경우 식별자 순으로 한다. 숫자 로그는 입력 순서대로 한다. 문제 풀..