diff --git a/binaryGap.php b/binaryGap.php index b380278..ccbe49d 100644 --- a/binaryGap.php +++ b/binaryGap.php @@ -3,6 +3,7 @@ function solution($n){ //Get the binary nof the number $bnry = decbin($n); + //trim zero from both sides $bnry=trim($bnry, "0"); //Explode string by 1-s //Compare the length of each