Concept Flow - First and Last Occurrence of Element
Start at index 0
Check if element at index == target?
No→Move to next index
Reached end of array?
No→Repeat check
Record index as first occurrence if none yet
Continue to find last occurrence
Reached end of array?
Yes→Return first and last occurrence indices
Start from the beginning of the array, check each element. Record the first time the target appears, keep updating the last occurrence until the end.
