When we have a loop and iterate over all elements, the time complexity is O(n). But when we have multiple loops (not nested), the time complexity is still O(n). Why? Or am I wrong here?
Example code:
func findElement(input: [Int]) {
for i in input { ... } // Loop1
for i in input { ... } // Loop2
for i in input { ... } // Loop3
}
Despite having three loops, the time complexity is O(n). Why?