Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit afc3a57

Browse files
Added README.md file for Two Sum
1 parent 5593346 commit afc3a57

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

‎1-two-sum/README.md‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<h2><a href="https://leetcode.com/problems/two-sum">Two Sum</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Given an array of integers <code>nums</code>&nbsp;and an integer <code>target</code>, return <em>indices of the two numbers such that they add up to <code>target</code></em>.</p>
2+
3+
<p>You may assume that each input would have <strong><em>exactly</em> one solution</strong>, and you may not use the <em>same</em> element twice.</p>
4+
5+
<p>You can return the answer in any order.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> nums = [2,7,11,15], target = 9
12+
<strong>Output:</strong> [0,1]
13+
<strong>Explanation:</strong> Because nums[0] + nums[1] == 9, we return [0, 1].
14+
</pre>
15+
16+
<p><strong class="example">Example 2:</strong></p>
17+
18+
<pre>
19+
<strong>Input:</strong> nums = [3,2,4], target = 6
20+
<strong>Output:</strong> [1,2]
21+
</pre>
22+
23+
<p><strong class="example">Example 3:</strong></p>
24+
25+
<pre>
26+
<strong>Input:</strong> nums = [3,3], target = 6
27+
<strong>Output:</strong> [0,1]
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>2 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>
35+
<li><code>-10<sup>9</sup> &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
36+
<li><code>-10<sup>9</sup> &lt;= target &lt;= 10<sup>9</sup></code></li>
37+
<li><strong>Only one valid answer exists.</strong></li>
38+
</ul>
39+
40+
<p>&nbsp;</p>
41+
<strong>Follow-up:&nbsp;</strong>Can you come up with an algorithm that is less than <code>O(n<sup>2</sup>)</code><font face="monospace">&nbsp;</font>time complexity?

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /