<filename>SW-Academy/leetcode_twosum.py<gh_stars>0
# -*- coding: utf-8 -*-
"""leetcode_twosum.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1RPnZuejWl1-nL1k0Q0m7BXYbwQduQJaJ
"""

# 문제: https://leetcode.com/problems/two-sum/

class Solution(object):
    from copy import deepcopy
    
    def twoSum(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
        output = []
        for i in range(len(nums)):
            y = target - nums[i]
            new_list = deepcopy(nums)
            new_list.pop(i)
            if y in new_list:
                output += [i]
                output += [new_list.index(y)+1]
                return output
            else:
                pass
<filename>SW-Academy/leetcode_twosum.py<gh_stars>0
# -*- coding: utf-8 -*-
"""leetcode_twosum.ipynb

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/1RPnZuejWl1-nL1k0Q0m7BXYbwQduQJaJ
"""

# 문제: https://leetcode.com/problems/two-sum/

class Solution(object):
    from copy import deepcopy
    
    def twoSum(self, nums, target):
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
        output = []
        for i in range(len(nums)):
            y = target - nums[i]
            new_list = deepcopy(nums)
            new_list.pop(i)
            if y in new_list:
                output += [i]
                output += [new_list.index(y)+1]
                return output
            else:
                pass
# -*- coding: utf-8 -*- leetcode_twosum.ipynb  Automatically generated by Colaboratory.  Original file is located at     https://colab.research.google.com/drive/1RPnZuejWl1-nL1k0Q0m7BXYbwQduQJaJ # 문제: https://leetcode.com/problems/two-sum/ :type nums: List[int]         :type target: int         :rtype: List[int]