What is the time complexity of this 2nd time updated code?