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

ReverseString   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 8
c 1
b 0
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A reverseString() 0 10 3
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