pushpitkc wrote:
Set S contains N integers. Is S a set of distinct consecutive integers?
1. The range of S in N
2. The range of S is less than N+1
Source:
Experts GlobalSo S contains N integers, which could be distinct or there could be repetitions. We have to determine whether S contains distinct consecutive integers or not.
Range of a list of numbers is the: (Max Value in that list) - (Min Value in that list)
(1) So N integers, and range is N only.
Lets take an example. Say there are 5 integers in this list and range is also 5. Can these 5 be consecutive?
NO. Because if we write 5 consecutive integers (x, x+1, x+2, x+3, x+4) then range of these would be '4' (1 less than 5).
So basically if we have N consecutive integers (x, x+1, x+2, x+3... , x+N-1) then their range would be 'N-1' (1 less than N).
Thus we can conclude that this list does NOT contain all distinct consecutive integers. This is thus sufficient to answer the question with a NO.
(2) There are N integers and range is less than N+1.
As explained in analysis of first statement, these integers could be all distinct consecutive, in which case range would be N-1 (which is less than N+1).
Or we could have all integers as same, in which case range would be '0' (still less than N+1).
So we cannot conclude whether this list contains distinct consecutive integers or not. Not sufficient.
Hence
A answer