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 942e7ae

Browse files
committed
Added README.md file for Largest 3-Same-Digit Number in String
1 parent f742769 commit 942e7ae

File tree

1 file changed

+49
-0
lines changed
  • 2346-largest-3-same-digit-number-in-string

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<h2><a href="https://leetcode.com/problems/largest-3-same-digit-number-in-string">Largest 3-Same-Digit Number in String</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>You are given a string <code>num</code> representing a large integer. An integer is <strong>good</strong> if it meets the following conditions:</p>
2+
3+
<ul>
4+
<li>It is a <strong>substring</strong> of <code>num</code> with length <code>3</code>.</li>
5+
<li>It consists of only one unique digit.</li>
6+
</ul>
7+
8+
<p>Return <em>the <strong>maximum good </strong>integer as a <strong>string</strong> or an empty string </em><code>&quot;&quot;</code><em> if no such integer exists</em>.</p>
9+
10+
<p>Note:</p>
11+
12+
<ul>
13+
<li>A <strong>substring</strong> is a contiguous sequence of characters within a string.</li>
14+
<li>There may be <strong>leading zeroes</strong> in <code>num</code> or a good integer.</li>
15+
</ul>
16+
17+
<p>&nbsp;</p>
18+
<p><strong class="example">Example 1:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> num = &quot;6<strong><u>777</u></strong>133339&quot;
22+
<strong>Output:</strong> &quot;777&quot;
23+
<strong>Explanation:</strong> There are two distinct good integers: &quot;777&quot; and &quot;333&quot;.
24+
&quot;777&quot; is the largest, so we return &quot;777&quot;.
25+
</pre>
26+
27+
<p><strong class="example">Example 2:</strong></p>
28+
29+
<pre>
30+
<strong>Input:</strong> num = &quot;23<strong><u>000</u></strong>19&quot;
31+
<strong>Output:</strong> &quot;000&quot;
32+
<strong>Explanation:</strong> &quot;000&quot; is the only good integer.
33+
</pre>
34+
35+
<p><strong class="example">Example 3:</strong></p>
36+
37+
<pre>
38+
<strong>Input:</strong> num = &quot;42352338&quot;
39+
<strong>Output:</strong> &quot;&quot;
40+
<strong>Explanation:</strong> No substring of length 3 consists of only one unique digit. Therefore, there are no good integers.
41+
</pre>
42+
43+
<p>&nbsp;</p>
44+
<p><strong>Constraints:</strong></p>
45+
46+
<ul>
47+
<li><code>3 &lt;= num.length &lt;= 1000</code></li>
48+
<li><code>num</code> only consists of digits.</li>
49+
</ul>

0 commit comments

Comments
(0)

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