I had a question about whether I was understanding the time complexity of the len function in Python correctly. I've seen multiple posts on this topic here and here but I feel like the answers didn't explicitly answer another question I had.
As I understand it, the time complexity of calling the len function is O(1) because the length of the object (e.g. an array) is stored behind the scenes. However, the time complexity of calling a function that isn't stored behind the scenes (e.g. max or min) is O(n) because we would have to search the entire array.
I'm wondering then, would it be correct to also think of the time complexity of len to be O(n) (because it takes n number of constant operations to keep track of the length of the array as we add or delete values from the array) but is only O(1) because we keep track of the length behind the scenes?
Technically, we should be able to store other information such as max and min while we create the array and accessing this information would also be O(1) if we explicitly save these values.
