retagged by
621 views

1 Answer

1 votes
1 votes
1st for loop run 1 time

2nd for loop(inner loop )run 2n time

3rd for loop only run 1st time for n time and for next 2n- 1 time it only check condition

So complexity is O(n)

Related questions

0 votes
0 votes
1 answer
1
1 votes
1 votes
1 answer
2
2 votes
2 votes
1 answer
3
gauravkc asked Apr 5, 2018
860 views
What is the time complexity of this code?
3 votes
3 votes
1 answer
4