<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> class Solution : <EOL> def twoSum_TLE ( self , num , target ) : <EOL> """<STR_LIT>""" <EOL> nums = num <EOL> for ind1 , val in enumerate ( nums ) : <EOL> try : <EOL> ind2 = nums . index ( target - val ) <EOL> return ind1 + <NUM_LIT:1> , ind2 + <NUM_LIT:1> <EOL> except ValueError : <EOL> continue <EOL> def twoSum_TLE_2 ( self , num , target ) : <EOL> nums = num <EOL> for ind1 , val in enumerate ( nums ) : <EOL> if target - val in nums : <EOL> return ind1 + <NUM_LIT:1> , nums . index ( target - val ) + <NUM_LIT:1> <EOL> def twoSum ( self , num , target ) : <EOL> """<STR_LIT>""" <EOL> hash_map = { } <EOL> for ind , val in enumerate ( num ) : <EOL> hash_map [ val ] = ind <EOL> for ind1 , val in enumerate ( num ) : <EOL> if target - val in hash_map : <EOL> ind2 = hash_map [ target - val ] <EOL> if ind1 != ind2 : <EOL> return ind1 + <NUM_LIT:1> , ind2 + <NUM_LIT:1> <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> print Solution ( ) . twoSum ( [ <NUM_LIT:3> , <NUM_LIT:2> , <NUM_LIT:4> ] , <NUM_LIT:6> ) </s>
