CodeMosa
Master LeetCode Patterns
All Patterns
Collections
Sign In
Back
Binary Search
Question 1 of 12
8% Complete
Easy
What's the difference between finding 'first occurrence' vs 'last occurrence' in binary search?
A
First occurrence: continue searching left after finding target; Last occurrence: continue searching right
B
First occurrence uses left pointer; Last occurrence uses right pointer
C
They are the same algorithm
D
First occurrence is O(log n); Last occurrence is O(n)
Need a hint?
Think about which direction you continue searching after finding a match