Brute force: Linear search

This is the most simple searching algorithm, and it is in O(n)O(n) time. In fact, give it a shot. You’ll probably be able to come up with it yourself!

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.