@Terence: So {1,1,1,4} is valid? Dave
On Dec 9, 6:30 am, Terence <technic....@gmail.com> wrote: > 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- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.