two sum leetcode via /r/learnprogramming

two sum leetcode

Hey guys I am having problems with one of the more basic leetcode problems. I don't know how to format code on reddit, but I did a pastebin.

Leetcode is saying my code has surpassed the time limit, what is the more efficient solution? Mine has to iterate a lot.

Basically you have to iterate through a list and find the indices of elements that add up to a target number(obviously with no repeat indices).

Submitted July 15, 2017 at 05:36PM by DerpOfTheAges
via reddit


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s