Skip to content

Commit f5a0bda

Browse files
committed
Create README - LeetHub
1 parent 75c7e08 commit f5a0bda

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<h2><a href="https://leetcode.com/problems/product-of-array-except-self/">238. Product of Array Except Self</a></h2><h3>Medium</h3><hr><div><p>Given an integer array <code>nums</code>, return <em>an array</em> <code>answer</code> <em>such that</em> <code>answer[i]</code> <em>is equal to the product of all the elements of</em> <code>nums</code> <em>except</em> <code>nums[i]</code>.</p>
2+
3+
<p>The product of any prefix or suffix of <code>nums</code> is <strong>guaranteed</strong> to fit in a <strong>32-bit</strong> integer.</p>
4+
5+
<p>You must write an algorithm that runs in&nbsp;<code>O(n)</code>&nbsp;time and without using the division operation.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong>Example 1:</strong></p>
9+
<pre><strong>Input:</strong> nums = [1,2,3,4]
10+
<strong>Output:</strong> [24,12,8,6]
11+
</pre><p><strong>Example 2:</strong></p>
12+
<pre><strong>Input:</strong> nums = [-1,1,0,-3,3]
13+
<strong>Output:</strong> [0,0,9,0,0]
14+
</pre>
15+
<p>&nbsp;</p>
16+
<p><strong>Constraints:</strong></p>
17+
18+
<ul>
19+
<li><code>2 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
20+
<li><code>-30 &lt;= nums[i] &lt;= 30</code></li>
21+
<li>The product of any prefix or suffix of <code>nums</code> is <strong>guaranteed</strong> to fit in a <strong>32-bit</strong> integer.</li>
22+
</ul>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Follow up:</strong>&nbsp;Can you solve the problem in <code>O(1)&nbsp;</code>extra&nbsp;space complexity? (The output array <strong>does not</strong> count as extra space for space complexity analysis.)</p>
26+
</div>

0 commit comments

Comments
 (0)