What is the time complexity
int j = 0; for(int i = 0; i < n; ++i) { while(j < n && arr[i] < arr[j]) { j++; } }
Answer: O(n)
What is the time complexity
int j = 0; for(int i = 0; i < n; ++i) { while(j < n && arr[i] < arr[j]) { j++; } }
Answer: O(n)