[Solved] time complexity for following function


Upto my knowledge, most common time complexity notation is Big-O, I’ll share same in this answer. Time complexity is O(1), with an assumption that Math.Pow calculation is O(1) and .ToString() method is O(1). It is O(1) because each step will be executed only once.

In gerenal, if we take .ToString().Length time complexity into account then it would be O(length of num1) because conversion from int to String will take O(length of num1) or O(number of digits). But as we are dealing with int, which will atmost have 11 digits, which is constant, we can say time complexity is O(1).

6

solved time complexity for following function