# data[].attributes.body
text

# data[].attributes.body
for number 1 we can iterate through array and use a set to keep track of visited values

# data[].attributes.headline
yeah, and return true and break when it finds a value twice

# data[].attributes.subject
yeah, and return true and break when it finds a value twice

# data[].attributes.body
yea that sounds good

# data[].attributes.body
def containsDuplicate(self, nums):
       hashset = set()  #Initialize hashset as a set
       if len(nums) == 0:
           return False
       else:
           for n in nums:
               if n in hashset:
                   return True
               else:
                   hashset.add(n)  # Add unique elements to hashset
           return False  # No duplicates found, return False

# data[].attributes.body
how were you able to write code in the box

# data[].attributes.body
for problem 2

I was thinking we take the first num, add it to each number in the list using a for loop, comparing the result with target, then if not found, goes back, takes the second element does the same thing, basically iterating. It is a tedious process and has high cost, what do u think, any other ideas?

# data[].attributes.body
i used leetcodes platform to write it and then just pasted it here

# data[].attributes.body
both approaches would work, but hash map might be better for Time complexity

# data[].attributes.body
do u use enumerate?

# data[].attributes.body
def solution(array, target):
    #Using hashmap to store the sum complements
    hashmap ={}

    for i in range(len(array)):
        #if the target
        if target - array[i] in hashmap:
            return [i, hashmap[target - array[i]]]
        else:
            hashmap[array[i]] = i

# data[].attributes.body
def solution(array, target):
    #Using hashmap to store the sum complements
    hashmap ={}

    for i in range(len(array)):
        #if the target
        if target - array[i] in hashmap:
            return [i, hashmap[target - array[i]]]
        else:
            hashmap[target - array[i]] = i

# data[].attributes.headline
hashtable, we check the difference between each entry and see if its one?

# data[].attributes.subject
hashtable, we check the difference between each entry and see if its one?

# data[].attributes.headline
do we leave it unsorted or can we sort it first?

# data[].attributes.subject
do we leave it unsorted or can we sort it first?

# data[].attributes.headline
it has to be sorted for the second example to work right

# data[].attributes.subject
it has to be sorted for the second example to work right