One solution would be to : check if max-min = N and that all elements are unique in the array. However, this may require space complexity.. Looking for a better solution.
On Jun 25, 12:44 am, ross <jagadish1...@gmail.com> wrote: > Given an array, A, find if all elements in the sorted version of A are > consecutive in less than O(nlogn). > eg: A: 5 4 1 2 3 on sorting 1 2 3 4 5 all elements are consecutive -- > true > A: 1 9 2 22 on sorting 1 2 9 22 all elements are NOT consecutive - > false -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@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.