Skip to content

Commit 72a4f22

Browse files
committed
Create README - LeetHub
1 parent a44a285 commit 72a4f22

File tree

1 file changed

+47
-0
lines changed
  • 2174-next-greater-numerically-balanced-number

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<h2><a href="https://leetcode.com/problems/next-greater-numerically-balanced-number">2174. Next Greater Numerically Balanced Number</a></h2><h3>Medium</h3><hr><p>An integer <code>x</code> is <strong>numerically balanced</strong> if for every digit <code>d</code> in the number <code>x</code>, there are <strong>exactly</strong> <code>d</code> occurrences of that digit in <code>x</code>.</p>
2+
3+
<p>Given an integer <code>n</code>, return <em>the <strong>smallest numerically balanced</strong> number <strong>strictly greater</strong> than </em><code>n</code><em>.</em></p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre>
9+
<strong>Input:</strong> n = 1
10+
<strong>Output:</strong> 22
11+
<strong>Explanation:</strong>
12+
22 is numerically balanced since:
13+
- The digit 2 occurs 2 times.
14+
It is also the smallest numerically balanced number strictly greater than 1.
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre>
20+
<strong>Input:</strong> n = 1000
21+
<strong>Output:</strong> 1333
22+
<strong>Explanation:</strong>
23+
1333 is numerically balanced since:
24+
- The digit 1 occurs 1 time.
25+
- The digit 3 occurs 3 times.
26+
It is also the smallest numerically balanced number strictly greater than 1000.
27+
Note that 1022 cannot be the answer because 0 appeared more than 0 times.
28+
</pre>
29+
30+
<p><strong class="example">Example 3:</strong></p>
31+
32+
<pre>
33+
<strong>Input:</strong> n = 3000
34+
<strong>Output:</strong> 3133
35+
<strong>Explanation:</strong>
36+
3133 is numerically balanced since:
37+
- The digit 1 occurs 1 time.
38+
- The digit 3 occurs 3 times.
39+
It is also the smallest numerically balanced number strictly greater than 3000.
40+
</pre>
41+
42+
<p>&nbsp;</p>
43+
<p><strong>Constraints:</strong></p>
44+
45+
<ul>
46+
<li><code>0 &lt;= n &lt;= 10<sup>6</sup></code></li>
47+
</ul>

0 commit comments

Comments
 (0)