Here's the question: My program gets an array of the size n, that contains numbers from 0 to n-1. You can assume that we don't get numbers below 0 or numbers above n-1.
I need to check if the array contains ALL the numbers between 0 to n-1, and return 1 if it does. 0 otherwise.
You are not allowed to use another array, and the program must run in O(n).
examples:
Array of the size 5: 4,1,0,3,2 return 1.
Array of the size 5: 4,1,0,3,1 return 0 (2 isn't in the array)
Tried in servral ways got stuck any help will be appreciated.