리트코드
-
[💕 LeetCode Python] 461. Hamming DistanceAlgorithm/1일 1코테 2020. 10. 27. 13:30
✍461. Hamming Distance✍ 문제 leetcode.com/problems/hamming-distance/ Hamming Distance - 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 내 답 def hammingDistance(self, x: int, y: int) -> int: # xor은 같으면 0, 다르면 1이므로 1의 갯수를 센다. return bin(x^y).count('1') 풀이 내 답이랑 똑같음
-
[💕 LeetCode Python] 136. Single NumberAlgorithm/1일 1코테 2020. 10. 27. 13:24
LeetCode 136. Single Number 문제 및 문제설명 leetcode.com/problems/single-number/ Single Number - 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 내가 쓴 답 def singleNumber(self, nums: List[int]) -> int: answer = {} #dict 생성 for i in nums: if i in answer: answer[i] += 1 else: answer[i] = 1 f..
-
[💕 LeetCode Python] 240. Search a 2D Matrix 2Algorithm/1일 1코테 2020. 10. 26. 20:10
✍ 240. Search a 2D Matrix 2 문제 leetcode.com/problems/search-a-2d-matrix-ii/submissions/ Search a 2D Matrix II - 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 내가 쓴 답 def searchMatrix(self, matrix, target): for i in matrix: if target in i: return True return False 풀이 def searchMatr..
-
[🤷♀️ LeetCode Python] 167. Two Sum 2 - Input array is sortedAlgorithm/1일 1코테 2020. 10. 26. 19:30
✍ 167. Two Sum 2 - Input array is sorted 문제 및 문제설명 leetcode.com/problems/two-sum-ii-input-array-is-sorted/ Two Sum II - Input array is sorted - 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 내가 쓴 답 # 시간초과로 탈락 def twoSum(self, numbers: List[int], target: int) -> List[int]: for i in..
-
[💕 LeetCode Python] 349. Intersection of Two ArraysAlgorithm/1일 1코테 2020. 10. 26. 18:33
✍LeetCode✍ 349. Intersection of Two Arrays 문제 leetcode.com/problems/intersection-of-two-arrays/submissions/ Intersection of Two Arrays - 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 내가 쓴 답 def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: answer = [] # 답안 ..
-
[💕 LeetCode Python] 704. Binary SearchAlgorithm/1일 1코테 2020. 10. 26. 14:27
리트코드 [ 704. Binary Search ] 문제 및 문제설명 leetcode.com/problems/binary-search/submissions/ Binary Search - 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 내가 제출한 답 def search(self, nums: List[int], target: int) -> int: if any(i == target for i in nums): # target이랑 같은 값이 있으면 return nums..