Although I have used only one loop, I don't think the time complexity of my code is O(n). Could anyone please explain me the time complexity of the code below.
public class PatternPyramid {
public static void main(String[] args) {
int rows = 15;
int i = 0;
int j = 0;
int k = rows - 1;
while (i < rows) {
if (j < k) {
System.out.print(" ");
j++;
} else if (j < rows) {
j++;
System.out.print("* ");
} else {
j = 0;
i++;
k--;
System.out.println();
}
}
}
}