Test Failed
Push — master ( 1452f2...b83f43 )
by Jinyun
02:35 queued 10s
created

ReverseString::reverseString()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 10
rs 10
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace leetcode;
6
7
class ReverseString
8
{
9
    public static function reverseString(string &$s): void
10
    {
11
        if (empty($s)) {
12
            return;
13
        }
14
        [$i, $j] = [0, strlen($s) - 1];
15
        while ($i < $j) {
16
            [$s[$i], $s[$j]] = [$s[$j], $s[$i]];
17
            $i++;
18
            $j--;
19
        }
20
    }
21
}
22