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

Appearance settings

Commit 2f5d0ac

Browse filesBrowse files
committed
Create README - LeetHub
1 parent bd92fae commit 2f5d0ac
Copy full SHA for 2f5d0ac

File tree

Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed

‎923-3sum-with-multiplicity/README.md

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<h2><a href="https://leetcode.com/problems/3sum-with-multiplicity/">923. 3Sum With Multiplicity</a></h2><h3>Medium</h3><hr><div><p>Given an integer array <code>arr</code>, and an integer <code>target</code>, return the number of tuples <code>i, j, k</code> such that <code>i &lt; j &lt; k</code> and <code>arr[i] + arr[j] + arr[k] == target</code>.</p>
2+
3+
<p>As the answer can be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong>Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> arr = [1,1,2,2,3,3,4,4,5,5], target = 8
9+
<strong>Output:</strong> 20
10+
<strong>Explanation: </strong>
11+
Enumerating by the values (arr[i], arr[j], arr[k]):
12+
(1, 2, 5) occurs 8 times;
13+
(1, 3, 4) occurs 8 times;
14+
(2, 2, 4) occurs 2 times;
15+
(2, 3, 3) occurs 2 times.
16+
</pre>
17+
18+
<p><strong>Example 2:</strong></p>
19+
20+
<pre><strong>Input:</strong> arr = [1,1,2,2,2,2], target = 5
21+
<strong>Output:</strong> 12
22+
<strong>Explanation: </strong>
23+
arr[i] = 1, arr[j] = arr[k] = 2 occurs 12 times:
24+
We choose one 1 from [1,1] in 2 ways,
25+
and two 2s from [2,2,2,2] in 6 ways.
26+
</pre>
27+
28+
<p>&nbsp;</p>
29+
<p><strong>Constraints:</strong></p>
30+
31+
<ul>
32+
<li><code>3 &lt;= arr.length &lt;= 3000</code></li>
33+
<li><code>0 &lt;= arr[i] &lt;= 100</code></li>
34+
<li><code>0 &lt;= target &lt;= 300</code></li>
35+
</ul>
36+
</div>

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.