LeetCode(2)
-
Day4 Two Pointers - LeetCode 14day
class Solution: def reverseString(self, s: List[str]) -> None: """ Do not return anything, modify s in-place instead. """ s.reverse() https://leetcode.com/problems/reverse-string/?envType=study-plan&id=algorithm-i Reverse String - 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 파이썬..
2022.12.15 -
Day3 Two Pointers - LeetCode 14day (Time Limit Exceeded로 실패)
class Solution: def twoSum(self, numbers: List[int], target: int) -> List[int]: # 값을 확인한다 # 방법이 생각났다 ㅋㅋ # 타겟에서, 인덱스 차례로 값을 뺸 뒤, 남은 배열에서 그 값이 있는지를 확인한다. # 당연히 자기자신은 제외한다. # 있으면 값을 반환하고 없으면 반복한다. """ # 1 check target value # 2 umm. nice ! # 3 subtract target from numbers[index] # 4 find value with target - numbers[i] # 4 if find return right index or could not find, then one more time. (because it..
2022.12.15