Skip to content

Commit d68d369

Browse files
committed
Create README - LeetHub
1 parent bb48fe6 commit d68d369

File tree

1 file changed

+38
-0
lines changed
  • 4112-maximize-expression-of-three-elements

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<h2><a href="https://leetcode.com/problems/maximize-expression-of-three-elements">4112. Maximize Expression of Three Elements</a></h2><h3>Easy</h3><hr><p>You are given an integer array <code>nums</code>.</p>
2+
3+
<p>Choose three elements <code>a</code>, <code>b</code>, and <code>c</code> from <code>nums</code> at <strong>distinct</strong> indices such that the value of the expression <code>a + b - c</code> is maximized.</p>
4+
5+
<p>Return an integer denoting the <strong>maximum possible value</strong> of this expression.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<div class="example-block">
11+
<p><strong>Input:</strong> <span class="example-io">nums = [1,4,2,5]</span></p>
12+
13+
<p><strong>Output:</strong> <span class="example-io">8</span></p>
14+
15+
<p><strong>Explanation:</strong></p>
16+
17+
<p>We can choose <code>a = 4</code>, <code>b = 5</code>, and <code>c = 1</code>. The expression value is <code>4 + 5 - 1 = 8</code>, which is the maximum possible.</p>
18+
</div>
19+
20+
<p><strong class="example">Example 2:</strong></p>
21+
22+
<div class="example-block">
23+
<p><strong>Input:</strong> <span class="example-io">nums = [-2,0,5,-2,4]</span></p>
24+
25+
<p><strong>Output:</strong> <span class="example-io">11</span></p>
26+
27+
<p><strong>Explanation:</strong></p>
28+
29+
<p>We can choose <code>a = 5</code>, <code>b = 4</code>, and <code>c = -2</code>. The expression value is <code>5 + 4 - (-2) = 11</code>, which is the maximum possible.</p>
30+
</div>
31+
32+
<p>&nbsp;</p>
33+
<p><strong>Constraints:</strong></p>
34+
35+
<ul>
36+
<li><code>3 &lt;= nums.length &lt;= 100</code></li>
37+
<li><code>-100 &lt;= nums[i] &lt;= 100</code></li>
38+
</ul>

0 commit comments

Comments
 (0)