Skip to content

Commit 9d863bd

Browse files
committed
feat: add typescript solution to lc problem: No.2264
No.2264.Largest 3-Same-Digit Number in String
1 parent 4429474 commit 9d863bd

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

solution/2200-2299/2264.Largest 3-Same-Digit Number in String/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@
8383
### **TypeScript**
8484

8585
```ts
86-
86+
function largestGoodInteger(num: string): string {
87+
for (let i = 9; i >= 0; i--) {
88+
const c = String(i).repeat(3);
89+
if (num.includes(c)) return c;
90+
}
91+
return '';
92+
};
8793
```
8894

8995
### **...**

solution/2200-2299/2264.Largest 3-Same-Digit Number in String/README_EN.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@
7373
### **TypeScript**
7474

7575
```ts
76-
76+
function largestGoodInteger(num: string): string {
77+
for (let i = 9; i >= 0; i--) {
78+
const c = String(i).repeat(3);
79+
if (num.includes(c)) return c;
80+
}
81+
return '';
82+
};
7783
```
7884

7985
### **...**
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function largestGoodInteger(num: string): string {
2+
for (let i = 9; i >= 0; i--) {
3+
const c = String(i).repeat(3);
4+
if (num.includes(c)) return c;
5+
}
6+
return '';
7+
};

0 commit comments

Comments
 (0)