Question DSA-CX-0009
MediumWhat is the time complexity of this code?
i = 1
while i < n:
i *= 2
- A.
O(n log n)
- B.
O(n)
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Complexity Analysis question
What is the time complexity of this code?
i = 1
while i < n:
i *= 2
O(n log n)
O(n)
Sign up free to see the answer and a step-by-step explanation.
O(log n)
O(√n)