Welcome back.
Now let's try to think of the space and time complexity for the greedy approaches that we have discussed.
So when it comes to the time complexity for the greedy approach one as well as the greedy approach,
number two, the time complexity is going to be of the order of n because we are just making one pass
through the input array.
Okay.
So that's why the time complexity of these solutions is of the order of n.
And when it comes to the space complexity, it's going to be of the order of one because we are not
using any auxiliary space.