Created
January 24, 2019 08:25
-
-
Save rummykhan/9bb12522cd1c26a778ee207f336ae62e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = [1, 2, 3, 4, 6, 7]; | |
sort($a); | |
if ($a[0] != 1) { | |
return 0; | |
} | |
if ($a[0] < 1) { | |
return 0; | |
} | |
$supposed = $a[0] + (count($a) - 1); | |
$isMissing = $supposed != $a[count($a) - 1]; | |
return $isMissing ? 0 : 1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment