###### tags: `LeetCode` 1.Two Sum === A、暴力法: 想法: 主要使用O(n*n)的方式來處理,直接把目標總和扣掉他來找樹木,找到一個數值,沒有放在字典裏面的話先把它塞到字典裏面, 作法: ``` class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ d={} for i in range(len(nums)): num1 = nums[i] num2 = target -nums[i] if num2 in d: return [d[num2],i] d[num1]=i ``` B、 two pointer