일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 상가수익률계산기
- 알고리즘풀이
- python zip_longest
- python 알고리즘
- leetcode풀기
- python sorted
- 파이썬알고리즘풀기
- 잇츠디모
- 릿코드 파이썬
- python priority queue
- binary search
- 파이썬 알고리즘 풀기
- 파이썬 프로그래머스
- python Leetcode
- python 릿코드
- LeetCode
- 릿코드
- 파이썬알고리즘
- leetcode 풀기
- 파이썬릿코드풀기
- 파이썬릿코드
- leetcode풀이
- 코틀린기초
- 파이썬 알고리즘
- 파이썬 릿코드
- 알고리즘풀기
- python xor
- 릿코드 풀기
- 릿코드풀기
- 릿코드풀이
- Today
- Total
목록LeetCode (8)
소프트웨어에 대한 모든 것

43. Multiply Strings https://leetcode.com/problems/multiply-strings/ Multiply Strings - 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) Built-in BigInteger library를 사용하지 말아햐 하는 조건이 있다. string을 number로 바꾸는 함수를 만들어야한다. class Solution: def multiply(self, num1: str, num2: str..

1832. Check if the Sentence Is Pangram https://leetcode.com/problems/check-if-the-sentence-is-pangram/ 문제) 솔루션1) 각 알파벳을 해쉬에 저장 sentence에서 문자를 해쉬에서 key 값 서치해서 있으면 삭제 해쉬의 사이즈가 0이면 pangram을 만족하기 때문에 True를 리턴, 아니면 False class Solution: def checkIfPangram(self, sentence: str) -> bool: alphabets = 'abcdefghijklmnopqrstuvwxyz' d = {} for c in alphabets: d[c] = None for c in sentence: if c in d: del d[c..

1588. Sum of All Odd Length Subarrays 문제) 솔루션1) class Solution: def sumOddLengthSubarrays(self, arr: List[int]) -> int: res = 0 n = len(arr) for j in range(1, len(arr)+1, 2): for i in range(n - j + 1): res += sum(arr[i:i+j]) return res

2006. Count Number of Pairs With Absolute Difference K 문제) 솔루션1) Brute-force class Solution: def countKDifference(self, nums: List[int], k: int) -> int: count = 0 for i in range(len(nums)): for j in range(i, len(nums)): if i != j and abs(nums[i] - nums[j]) == k: count += 1 return count 솔루션2) 조합 사용 class Solution: def countKDifference(self, nums: List[int], k: int) -> int: count = 0 for i, j in c..

Richest Customer Wealth 문제) 솔루션1) class Solution: def maximumWealth(self, accounts: List[List[int]]) -> int: max_wealth = 0 for account in accounts: max_wealth = max(max_wealth, sum(account)) return max_wealth 솔루션2) class Solution: def maximumWealth(self, accounts: List[List[int]]) -> int: return max(map(sum, accounts))

Final Value of Variable After Performing Operations 문제) 솔루션1) class Solution: def finalValueAfterOperations(self, operations: List[str]) -> int: val = 0 for operation in operations: if '+' in operation: val += 1 else: val -= 1 return val 솔루션2) class Solution: def finalValueAfterOperations(self, operations: List[str]) -> int: return sum(1 if '+' in operation else -1 for operation in operations)

concatenation of Array 문제) 솔루션1) class Solution: def getConcatenation(self, nums: List[int]) -> List[int]: return nums + nums 솔루션2) class Solution: def getConcatenation(self, nums: List[int]) -> List[int]: return nums * 2

Build Array from Permutation 문제) 솔루션1) class Solution: def buildArray(self, nums: List[int]) -> List[int]: ret = [] for num in nums: ret.append(nums[num]) return ret; 솔루션2) class Solution: def buildArray(self, nums: List[int]) -> List[int]: return [nums[num] for num in nums]