File tree Expand file tree Collapse file tree 3 files changed +49
-0
lines changed
solution/1800-1899/1876.Substrings of Size Three with Distinct Characters Expand file tree Collapse file tree 3 files changed +49
-0
lines changed Original file line number Diff line number Diff 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```
Original file line number Diff line number Diff 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```
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments