Sail E0 Webinar
Question
What is the time complexity of the above code?
Options:
A .  O(logn)
B .  O(n)
C .  O(1)
D .  O(nlogn)
Answer: Option B


All the characters in the string have to be processed, hence the complexity is O(n).



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers