File tree 3 files changed +55
-0
lines changed
solution/0200-0299/0263.Ugly Number
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,26 @@ func isUgly(n int) bool {
150
150
}
151
151
```
152
152
153
+ ### ** PHP**
154
+
155
+ ``` php
156
+ class Solution {
157
+ /**
158
+ * @param Integer $n
159
+ * @return Boolean
160
+ */
161
+ function isUgly($n) {
162
+ while ($n) {
163
+ if ($n % 2 == 0) $n = $n / 2;
164
+ else if ($n % 3 == 0) $n = $n / 3;
165
+ else if ($n % 5 == 0) $n = $n / 5;
166
+ else break;
167
+ }
168
+ return $n == 1;
169
+ }
170
+ }
171
+ ```
172
+
153
173
### ** ...**
154
174
155
175
```
Original file line number Diff line number Diff line change @@ -136,6 +136,26 @@ func isUgly(n int) bool {
136
136
}
137
137
```
138
138
139
+ ### ** PHP**
140
+
141
+ ``` php
142
+ class Solution {
143
+ /**
144
+ * @param Integer $n
145
+ * @return Boolean
146
+ */
147
+ function isUgly($n) {
148
+ while ($n) {
149
+ if ($n % 2 == 0) $n = $n / 2;
150
+ else if ($n % 3 == 0) $n = $n / 3;
151
+ else if ($n % 5 == 0) $n = $n / 5;
152
+ else break;
153
+ }
154
+ return $n == 1;
155
+ }
156
+ }
157
+ ```
158
+
139
159
### ** ...**
140
160
141
161
```
Original file line number Diff line number Diff line change
1
+ class Solution {
2
+ /**
3
+ * @param Integer $n
4
+ * @return Boolean
5
+ */
6
+ function isUgly ($n ) {
7
+ while ($n ) {
8
+ if ($n % 2 == 0 ) $n = $n / 2 ;
9
+ else if ($n % 3 == 0 ) $n = $n / 3 ;
10
+ else if ($n % 5 == 0 ) $n = $n / 5 ;
11
+ else break ;
12
+ }
13
+ return $n == 1 ;
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments