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 7048792

Browse files
authored
feat: add php solution to lc problem: No.1876 (#1014)
1 parent e65dd3d commit 7048792

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

‎solution/1800-1899/1876.Substrings of Size Three with Distinct Characters/README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ function countGoodSubstrings(s: string): number {
9999
}
100100
```
101101

102+
### **PHP**
103+
104+
```php
105+
class Solution {
106+
/**
107+
* @param String $s
108+
* @return Integer
109+
*/
110+
function countGoodSubstrings($s) {
111+
$cnt = 0;
112+
for ($i = 0; $i < strlen($s) - 2; $i++) {
113+
if ($s[$i] != $s[$i + 1] && $s[$i] != $s[$i + 2] && $s[$i + 1] != $s[$i + 2]) $cnt++;
114+
}
115+
return $cnt++;
116+
}
117+
}
118+
```
119+
102120
### **...**
103121

104122
```

‎solution/1800-1899/1876.Substrings of Size Three with Distinct Characters/README_EN.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ function countGoodSubstrings(s: string): number {
8989
}
9090
```
9191

92+
### **PHP**
93+
94+
```php
95+
class Solution {
96+
/**
97+
* @param String $s
98+
* @return Integer
99+
*/
100+
function countGoodSubstrings($s) {
101+
$cnt = 0;
102+
for ($i = 0; $i < strlen($s) - 2; $i++) {
103+
if ($s[$i] != $s[$i + 1] && $s[$i] != $s[$i + 2] && $s[$i + 1] != $s[$i + 2]) $cnt++;
104+
}
105+
return $cnt++;
106+
}
107+
}
108+
```
109+
92110
### **...**
93111

94112
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
/**
3+
* @param String $s
4+
* @return Integer
5+
*/
6+
function countGoodSubstrings($s) {
7+
$cnt = 0;
8+
for ($i = 0; $i < strlen($s) - 2; $i++) {
9+
if ($s[$i] != $s[$i + 1] && $s[$i] != $s[$i + 2] && $s[$i + 1] != $s[$i + 2]) $cnt++;
10+
}
11+
return $cnt++;
12+
}
13+
}

0 commit comments

Comments
(0)

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