Skip to content

Commit 7348fe3

Browse files
committed
Create README - LeetHub
1 parent 46b10fa commit 7348fe3

File tree

1 file changed

+37
-0
lines changed
  • 2441-largest-positive-integer-that-exists-with-its-negative

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<h2><a href="https://leetcode.com/problems/largest-positive-integer-that-exists-with-its-negative">2441. Largest Positive Integer That Exists With Its Negative</a></h2><h3>Easy</h3><hr><p>Given an integer array <code>nums</code> that <strong>does not contain</strong> any zeros, find <strong>the largest positive</strong> integer <code>k</code> such that <code>-k</code> also exists in the array.</p>
2+
3+
<p>Return <em>the positive integer </em><code>k</code>. If there is no such integer, return <code>-1</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> nums = [-1,2,-3,3]
10+
<strong>Output:</strong> 3
11+
<strong>Explanation:</strong> 3 is the only valid k we can find in the array.
12+
</pre>
13+
14+
<p><strong class="example">Example 2:</strong></p>
15+
16+
<pre>
17+
<strong>Input:</strong> nums = [-1,10,6,7,-7,1]
18+
<strong>Output:</strong> 7
19+
<strong>Explanation:</strong> Both 1 and 7 have their corresponding negative values in the array. 7 has a larger value.
20+
</pre>
21+
22+
<p><strong class="example">Example 3:</strong></p>
23+
24+
<pre>
25+
<strong>Input:</strong> nums = [-10,8,6,7,-2,-3]
26+
<strong>Output:</strong> -1
27+
<strong>Explanation:</strong> There is no a single valid k, we return -1.
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>1 &lt;= nums.length &lt;= 1000</code></li>
35+
<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>
36+
<li><code>nums[i] != 0</code></li>
37+
</ul>

0 commit comments

Comments
 (0)