This is an exercise on LeetCode. I get an except of
UnboundLocalError on line 15.
Why? And how to fix it?
class Solution(object):
def twoSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
self.nums = []
self.target = int
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[i] + nums[j] == target:
a = []
return a[i, j]