일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 | 31 |
- golang
- Programmers
- 백준
- BubbleSort
- Observer Pattern
- Codility
- 그리디
- Dynamic Programming
- Backjoon
- 알고리즘
- 피보나치
- go
- Python
- LeetCode
- Top-down
- Singleton Pattern
- kubernetes
- KAKAO
- easy
- GCP
- cpu scheduling
- github
- k8s
- mobaXTerm
- java
- Kotlin
- docker
- GKE
- 파이썬
- Today
- Total
목록LeetCode (37)
To Be Developer
https://leetcode.com/problems/monotonic-array/ class Solution(object): def isMonotonic(self, A): """ :type A: List[int] :rtype: bool """ # A의 길이 ln = len(A) # A의 길이가 1이면 무조건 True if ln == 1: return True # Decrease면 False, increase 면 True inDe = None # 1~ln-1 까지 반복 for i in range(1, ln): # 처음 inDe 가 비어있는 것은 A[i-1] 과 A[i]는 같다는 것을 뜻함 if inDe == None and A[i-1] != A[i]: # Decrease if A[i-1] > A[i]: ..
https://leetcode.com/problems/find-the-difference class Solution(object): def findTheDifference(self, s, t): # s의 알파벳을 key, 알파벳 수를 value 로 가지는 딕셔너리 dicS = {} # t의 알파벳을 key, 알파벳 수를 value 로 가지는 딕셔너리 dicT = {} # 시간 복잡도 O(N) # 공간 복잡도 O(N) for i in s: # 문자하나 카운트하여 dicS 에 대입 self.dicCount(dicS, i) # 시간 복잡도 O(M) for i in t: # 문자하나 카운트하여 dicT 에 대입 self.dicCount(dicT, i) # 시간 복잡도 O(M) for key, val in dic..
https://leetcode.com/problems/maximum-average-subarray-i/ Loading... 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 [Go 풀이] package main import "fmt" func main() { var nums = []int{4, 2, 1, 3, 3} fmt.Println(findMaxAverage(nums, 2)) } func findMaxAverage(nums []int, k int) float64 { // num..
https://leetcode.com/problems/find-pivot-index/ Loading... 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 [GoLang 풀이] package main import "fmt" func main() { a := []int{1, 7, 3, 6, 5, 6} fmt.Println(pivotIndex(a)) } func pivotIndex(nums []int) int { // nums의 길이 var numsLen int = len(nums) ..
https://leetcode.com/problems/repeated-substring-pattern/ LeetCode - The World's Leading Online Programming Learning Platform 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 [JAVA 풀이] class Solution { public boolean repeatedSubstringPattern(String s) { // 매개변수 s의 길이 int sLen = s.length(); /..
https://leetcode.com/problems/remove-duplicates-from-sorted-array/ Remove Duplicates from Sorted Array - 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 [GoLang 풀이] package main import "fmt" func main() { nums := []int{1, 1, 2} removeDuplicates(nums) } func removeDuplicates(nums []..