일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- binary search
- python Leetcode
- 파이썬알고리즘
- 파이썬 릿코드
- 릿코드 파이썬
- 파이썬릿코드
- python 릿코드
- 파이썬 알고리즘 풀기
- LeetCode
- 잇츠디모
- 릿코드풀이
- 알고리즘풀기
- 파이썬 알고리즘
- 파이썬릿코드풀기
- 코틀린기초
- python sorted
- python xor
- python zip_longest
- 릿코드 풀기
- python 알고리즘
- leetcode 풀기
- python priority queue
- 릿코드
- 알고리즘풀이
- 파이썬알고리즘풀기
- leetcode풀기
- leetcode풀이
- 파이썬 프로그래머스
- 상가수익률계산기
- 릿코드풀기
- Today
- Total
목록알고리즘/LeetCode (177)
소프트웨어에 대한 모든 것
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/DwgpF/btrj1Na1a2U/cdfszak03g1kF4IhgTXUyK/img.png)
1816. Truncate Sentence https://leetcode.com/problems/truncate-sentence/ Truncate Sentence - 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) class Solution: def truncateSentence(self, s: str, k: int) -> str: return ' '.join(s.split()[:k])
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/lSHXf/btrj0VmSkpb/fzK7af3M9LE2163HOwQRn0/img.png)
1913. Maximum Product Difference Between Two Pairs https://leetcode.com/problems/maximum-product-difference-between-two-pairs/ Maximum Product Difference Between Two 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) 시간 복잡도 : O(nlogn) 공간 복잡도 : O(1) class Solution: de..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/drJJ6J/btrjVBVTbZx/0zB695wVh80nocfmrH4K0K/img.png)
70. Climbing Stairs https://leetcode.com/problems/climbing-stairs/ Climbing Stairs - 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) 동적 계획법 풀이 class Solution: def climbStairs(self, n: int) -> int: ''' f(0) = 0 f(1) = 1 f(2) = 2 f(3) = f(2) + f(1) ... f(n) = f(n-1) + (n-2)..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bHzcN9/btrjKNAZLOM/IryWAw84RQPeX1PiX3KuNk/img.png)
380. Insert Delete GetRandom O(1) https://leetcode.com/problems/insert-delete-getrandom-o1/ Insert Delete GetRandom O(1) - 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) hash 자료구조 사용 getRandom()은 random.choice() 사용 class RandomizedSet: def __init__(self): ''' Initializes..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/IpXv9/btrjGcoLRRc/RFjkpBLX4sKlb8F1oV1zc1/img.png)
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..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cll7Ta/btrjAeNA7D8/9kVvaIzyyHPyCvQilavsck/img.png)
155. Min Stack https://leetcode.com/problems/min-stack/ Min Stack - 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) 두 개의 스택 활용(Normal Stack, Min Stack) Normal Stack에 요소가 추가될 때 Min Stack에는 현재의 min 요소를 추가 getMin() 호출 시 Min Stack에서 가장 상단의 요소를 리턴하면 됨. class MinStack: def __in..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/YPij3/btrjErLjxL7/RK5YUIyG6kHxNvbk5To7Sk/img.png)
https://leetcode.com/problems/power-of-two/ Power of Two - 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의 승수는 A & (A-1) = 0을 만족 예시) 16 -> 10000, 16-1 -> 01111, 16 & 15 -> 10000 & 01111 = 0 class Solution: def isPowerOfTwo(self, n: int) -> bool: if n == 0: return False..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/nqjeb/btrjqpm99oX/ox8A7xRvfjGmOV6xxR3AOk/img.png)
https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - 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) class Solution: def isValid(self, s: str) -> bool: end_parentheses = [')', ']', '}'] stack = [] stack.append(s[0]) for c in s[1:]: if c i..