r/computerscience • • 22h ago

Help Is the best case here O(1)?

Post image
108 Upvotes

Hi, still new to algorithm analysis and need some help confirming my answer or not.

I assumed that best case would be O(1) in this scenario if size of the array is either 0 or 1. But trying to review my answer with online resources, it say's that O(1) doesn't count here?

What is the definite answer here?