I'd suggest you use binary search for searching for the element; if a valid array index is there, return true, else return false.
Now, adapting it for different scenarios is another story. However, if you want an example, I would love to expand this! :)