File tree 3 files changed +49
-0
lines changed
solution/1900-1999/1941.Check if All Characters Have Equal Number of Occurrences
3 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,24 @@ function areOccurrencesEqual(s: string): boolean {
156
156
}
157
157
```
158
158
159
+ ### ** PHP**
160
+
161
+ ``` php
162
+ class Solution {
163
+ /**
164
+ * @param String $s
165
+ * @return Boolean
166
+ */
167
+ function areOccurrencesEqual($s) {
168
+ for ($i = 0; $i < strlen($s); $i++) {
169
+ $hashtable[$s[$i]] += 1;
170
+ }
171
+ $rs = array_unique($hashtable);
172
+ return count($rs) === 1;
173
+ }
174
+ }
175
+ ```
176
+
159
177
### ** ...**
160
178
161
179
```
Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ function areOccurrencesEqual(s: string): boolean {
140
140
}
141
141
```
142
142
143
+ ### ** PHP**
144
+
145
+ ``` php
146
+ class Solution {
147
+ /**
148
+ * @param String $s
149
+ * @return Boolean
150
+ */
151
+ function areOccurrencesEqual($s) {
152
+ for ($i = 0; $i < strlen($s); $i++) {
153
+ $hashtable[$s[$i]] += 1;
154
+ }
155
+ $rs = array_unique($hashtable);
156
+ return count($rs) === 1;
157
+ }
158
+ }
159
+ ```
160
+
143
161
### ** ...**
144
162
145
163
```
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ /**
3
+ * @param String $s
4
+ * @return Boolean
5
+ */
6
+ function areOccurrencesEqual ($s ) {
7
+ for ($i = 0 ; $i < strlen ($s ); $i ++ ) {
8
+ $hashtable [$s [$i ]] += 1 ;
9
+ }
10
+ $rs = array_unique ($hashtable );
11
+ return count ($rs ) === 1 ;
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments