Marks :10
: 1 | : 0
Nick has been given a list of random numbers by his teacher. His task is to arrange all the numbers in increasing order, and check whether the numbers are consecutive or not. If all the numbers are consecutive, output "YES", otherwise output "NO".
The first line consists of an integer $$$n$$$ $$$-$$$ the total number of integers given by the teacher $$$(1 \leq n \leq 10^6)$$$. The next line consists of $$$n$$$ space separated integers, $$$a_i$$$ $$$(1 \leq a_i \leq 10^9)$$$ the numbers of the array.
Output a single word - "YES" if the marks are consecutive, "NO" otherwise.
4 7 8 5 6
YES
4 10 8 9 8
NO
5 1 9 10 4 2
NO
Note that if two marks are the same, then they are not considered consecutive.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.