A[1..N] is Valid <=> max{A[i]} - min{A[i]} == N-1

On 2010-12-9 20:16, Prims wrote:
Given array A with n elements, give an algorithm for finding whether
it’s a valid array or not?
Array is called Valid if all the numbers appearing in A [1...N] are
consecutive numbers.

Example: A={5,3,4} is a valid array
A={3,7,5,4,6} is a valid array


--
You received this message because you are subscribed to the Google Groups "Algorithm 
Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to