Python
단순풀이
첫시도 timeout
두번째 성공 했는데 6712ms
성능 개선 필요함
array 에 넣고 검색
832 ms, 28.50%
```python class Solution: def twoSum(self, nums, target): length = len(nums) for i in range(length - 1): find_num = target - nums[i]
solution = Solution()
print(solution.twoSum([2, 7, 11, 15], 9)) assert(solution.twoSum([2, 7, 11, 15], 9) == [0, 1]) print(solution.twoSum([3, 2, 4], 6)) assert(sorted(solution.twoSum([3, 2, 4], 6)) == sorted([1, 2])) ```
Last updated
Was this helpful?