Q1151
What is the time complexity of the following code used to find the length of the string? #include int get_len(char *s) int len = 0; while(s[len] != '\0') len++; return len; int main() char *s = "lengthofstring"; int len = get_len(s); printf("%d",len); return 0;
A.
O(1)
B.
O(n)
AnswerC.
O(n2)
D.
O(logn)
Answer: Option B
Solution
Answer: Option B
No explanation is given for this question Let's Discuss on Board