Skip to content

Commit 1f9ce85

Browse files
committed
Runtime: 0 ms (Top 100.0%) | Memory: 2.10 MB (Top 66.67%)
1 parent e5bacdb commit 1f9ce85

File tree

1 file changed

+123
-0
lines changed

1 file changed

+123
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// Runtime: 0 ms (Top 100.0%) | Memory: 2.10 MB (Top 66.67%)
2+
3+
impl Solution {
4+
pub fn next_beautiful_number(n: i32) -> i32 {
5+
let numbers = [
6+
1,
7+
22,
8+
122,
9+
212,
10+
221,
11+
333,
12+
1333,
13+
3133,
14+
3313,
15+
3331,
16+
4444,
17+
14444,
18+
22333,
19+
23233,
20+
23323,
21+
23332,
22+
32233,
23+
32323,
24+
32332,
25+
33223,
26+
33232,
27+
33322,
28+
41444,
29+
44144,
30+
44414,
31+
44441,
32+
55555,
33+
122333,
34+
123233,
35+
123323,
36+
123332,
37+
132233,
38+
132323,
39+
132332,
40+
133223,
41+
133232,
42+
133322,
43+
155555,
44+
212333,
45+
213233,
46+
213323,
47+
213332,
48+
221333,
49+
223133,
50+
223313,
51+
223331,
52+
224444,
53+
231233,
54+
231323,
55+
231332,
56+
232133,
57+
232313,
58+
232331,
59+
233123,
60+
233132,
61+
233213,
62+
233231,
63+
233312,
64+
233321,
65+
242444,
66+
244244,
67+
244424,
68+
244442,
69+
312233,
70+
312323,
71+
312332,
72+
313223,
73+
313232,
74+
313322,
75+
321233,
76+
321323,
77+
321332,
78+
322133,
79+
322313,
80+
322331,
81+
323123,
82+
323132,
83+
323213,
84+
323231,
85+
323312,
86+
323321,
87+
331223,
88+
331232,
89+
331322,
90+
332123,
91+
332132,
92+
332213,
93+
332231,
94+
332312,
95+
332321,
96+
333122,
97+
333212,
98+
333221,
99+
422444,
100+
424244,
101+
424424,
102+
424442,
103+
442244,
104+
442424,
105+
442442,
106+
444224,
107+
444242,
108+
444422,
109+
515555,
110+
551555,
111+
555155,
112+
555515,
113+
555551,
114+
666666,
115+
];
116+
for num in numbers {
117+
if num > n {
118+
return num;
119+
}
120+
}
121+
1224444
122+
}
123+
}

0 commit comments

Comments
 (0)