Concept Flow - First and Last Occurrence of Element
Start: Given array and target element
Initialize first = -1, last = -1
Traverse array from start to end
For each element: Is element == target?
Update first if first == -1
Update last
Continue until end of array
Return first and last indices
Done
We scan the array once, updating first and last positions when we find the target element.
