Two passes through an array O(n) or O(2n)

Viewed 2058

I was on interview cake practicing some questions, and on question 2 the solution given uses two separate for loops (not nested) and the solution provider claims that he/she solved it in O(n) time. From my understanding that would be O(2n) time. Am I wrong in thinking this, or did the solution provider make a mistake?

Excerpt from interview cake : enter image description here

2 Answers
Related