Skip to content

Commit 7449712

Browse files
authored
feat: add php solution to lc problem: No.1523 (#902)
No.1523.Count Odd Numbers in an Interval Range
1 parent 60e42cd commit 7449712

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

solution/1500-1599/1523.Count Odd Numbers in an Interval Range/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,21 @@ int countOdds(int low, int high) {
107107
}
108108
```
109109
110+
### **PHP**
111+
112+
```php
113+
class Solution {
114+
/**
115+
* @param Integer $low
116+
* @param Integer $high
117+
* @return Integer
118+
*/
119+
function countOdds($low, $high) {
120+
return (($high + 1) >> 1) - ($low >> 1);
121+
}
122+
}
123+
```
124+
110125
### **...**
111126

112127
```

solution/1500-1599/1523.Count Odd Numbers in an Interval Range/README_EN.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ int countOdds(int low, int high) {
105105
}
106106
```
107107
108+
### **PHP**
109+
110+
```php
111+
class Solution {
112+
/**
113+
* @param Integer $low
114+
* @param Integer $high
115+
* @return Integer
116+
*/
117+
function countOdds($low, $high) {
118+
return (($high + 1) >> 1) - ($low >> 1);
119+
}
120+
}
121+
```
122+
108123
### **...**
109124

110125
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
3+
/**
4+
* @param Integer $low
5+
* @param Integer $high
6+
* @return Integer
7+
*/
8+
function countOdds($low, $high) {
9+
return (($high + 1) >> 1) - ($low >> 1);
10+
}
11+
}

0 commit comments

Comments
 (0)