| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- 컴퓨터사이언스
- CNN
- db
- sort
- mysql
- 오블완
- meshgraphnet
- GNN
- 코딩테스트
- adaptive remeshing
- 데베
- 자료구조
- SQL
- Leet Code
- 개발자
- 대학생
- LeetCode
- 코테
- 데이터
- code
- Python
- CS
- 티스토리챌린지
- Database
- 컴퓨터공학
- DS
- Mesh
- 데이터베이스
- coding
- Data_Structure
- Today
- Total
목록coding (11)
sy1214ei 님의 블로그
https://leetcode.com/problems/keyboard-row/description/level : easyclass Solution: def findWords(self, words: List[str]) -> List[str]: set1 = {'q','w','e','r','t','y','u','i','o','p'} set2 = {'a','s','d','f','g','h','j','k','l'} set3 = {'z','x','c','v','b','n','m'} res = [] for i in words: wordset = set(i.lower()) if (wordset&se..
https://leetcode.com/problems/two-sum/description/Level: EasyTopics: Array | Hash Tableclass Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: """ 1. for i, num in enumerate(nums) : 뭔가 순회를 해야 찾든말든 할것임 2. 우리가 찾는 것 find = target - num 3. 만약 hash_table에 find가 있다면 return 4. hash_table[num] = i """ hash_table = {} for i, ..
https://leetcode.com/problems/palindrome-number/description/Level : EasyTopic : Mathclass Solution: def isPalindrome(self, x: int) -> bool: # 음수라면 False # 0이라면 true # 양수라면 # 1. 한자리수 -> true # 2. not 한자리수 # n = len(str(x))//2 -> 반복문을 n번 돌며 앞뒤가 다르면 false 같으면 반복문 계속돌기 if x
level : EasyTopics : Linked List | Recursionhttps://leetcode.com/problems/merge-two-sorted-lists/#Definition for singly-linked list.class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = nextclass Solution: def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: dummy = ListNode() # 더미 노드 생성 ..
Level : EasyTopics : String https://leetcode.com/problems/length-of-last-word/description/Codeclass Solution: def lengthOfLastWord(self, s: str) -> int: # 1. str의 뒤 공백을 없애줍니다 # 2. str을 뒤에서 부터 돌면서 ' '이 나온다면 break # 3. return cnt s = list(s) for i in range(len(s)-1, -1, -1): if s[i] == ' ': s.pop(i) else: ..
class Solution: def dominantIndex(self, nums: List[int]) -> int: sorted_nums = sorted(nums) if sorted_nums[-1] >= sorted_nums[-2]*2: for i in range(len(nums)): if sorted_nums[-1] == nums[i]: return i else : return -1 # Time Complexity : O(n) # Space Complexity : O(n)
class Solution: def maximumProduct(self, nums: List[int]) -> int: nums = sorted(nums) return max(nums[0]*nums[1]*nums[-1],nums[-1]*nums[-2]*nums[-3])
class Solution: # def selection_sort(self, nums): # for i in range(len(nums)): # smallest = i # for j in range(i+1, len(nums)): # if nums[j] int: # nums = self.selection_sort(nums) nums.sort() result = 0 for i in range(0,len(nums), 2): result += nums[i] return result
class Solution: def intersect(self, nums1: List[int], nums2: List[int]) -> List[int]: # arr = [] -> 겹치는 숫자 저장하는 arr arr = [] for i in range(len(nums1)): for j in range(len(nums2)): if nums1[i] == nums2[j]: arr.append(nums1[i]) nums2.pop(j) break return arr # Time Complexity : O(n^..
[Level] Medium[Topics] Array Sorting Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.https://leetcode.com/problems/merge-intervals/ IdeaCodeclass Solution: def selection_sort(self, intervals): for i in range(len(intervals)): smalles..