일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 파이썬릿코드
- leetcode풀이
- python 릿코드
- 릿코드 파이썬
- 상가수익률계산기
- 알고리즘풀기
- 파이썬 프로그래머스
- 릿코드
- 파이썬 알고리즘 풀기
- 코틀린기초
- python sorted
- leetcode 풀기
- LeetCode
- 파이썬알고리즘풀기
- 릿코드풀이
- 파이썬릿코드풀기
- python xor
- 릿코드 풀기
- python zip_longest
- python priority queue
- 알고리즘풀이
- python 알고리즘
- python Leetcode
- 잇츠디모
- 파이썬 릿코드
- leetcode풀기
- binary search
- 파이썬알고리즘
- 파이썬 알고리즘
- 릿코드풀기
- Today
- Total
목록leetcode풀이 (5)
소프트웨어에 대한 모든 것
1688. Count of Matches in Tournament https://leetcode.com/problems/count-of-matches-in-tournament/ Count of Matches in Tournament - 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) 문제안에 정답이 있다. 짝수 - n/2 matches, n/2 teams advance 홀수 - (n-1) / 2 matches, (n-1)/2 + 1 teams a..
1773. Count Items Matching a Rule 문제) 솔루션1) class Solution: def countMatches(self, items: List[List[str]], ruleKey: str, ruleValue: str) -> int: type_dict = {} color_dict = {} name_dict ={} for item in items: if item[0] in type_dict: type_dict[item[0]] += 1 else: type_dict[item[0]] = 1 if item[1] in color_dict: color_dict[item[1]] += 1 else: color_dict[item[1]] = 1 if item[2] in name_dict: name_..
Shuffle String 문제) 솔루션1) class Solution: def restoreString(self, s: str, indices: List[int]) -> str: res = [0] * len(s) for i1, i2 in enumerate(indices): res[i2] = s[i1] return ''.join(res) 솔루션2) class Solution: def restoreString(self, s: str, indices: List[int]) -> str: res = [0] * len(s) for idx, ch in enumerate(s): res[indices[idx]] = ch return ''.join(res)
Queries on Number of Points Inside a Circle 문제) 풀이 아이디어) 원안에 점(points)이 몇 개 있는가? 원의 중심과 점과의 거리가 r 보다 작다면 원안에 있는 것을 의미 솔루션1) class Solution: def countPoints(self, points: List[List[int]], queries: List[List[int]]) -> List[int]: ret = [] for circle in queries: count_in_circle = 0 for point in points: distance = self._distance(circle, point) if distance List[int]: return [sum(self._distance_hypot(c..
Running Sum of 1d Array 문제) 솔루션1) class Solution: def runningSum(self, nums: List[int]) -> List[int]: ret = [nums[0]] for i in range(1, len(nums)): ret.append(ret[i-1] + nums[i]) return ret 솔루션2) from itertools import accumulate class Solution: def runningSum(self, nums: List[int]) -> List[int]: return list(accumulate(nums)) 힌트) itertools.accumulate() 함수는 누적합을 계산