The complexity of this method is O(n), where n is the length of the array.
How is temporal complexity calculated?
The duration of an algorithm's execution, or temporal complexity, depends on size of the input. It determines how long it would take for each code statement in an algorithm to execute. It won't consider how long an algorithm takes to execute overall. Instead, it will show how the number of steps in an algorithm affects the runtime variation (increase or decrease). Yes, as indicated the only thing that affects the amount of time needed is the size of the input.
To know more about Time complexity
https://brainly.com/question/15549566
#SPJ4