I was wondering how i can minimize the runtime of the following code
int j = 0;
while (j < n) {
int i = 0;
while (i < m) {
cout << i*j;
i++;
}
j++;
}
I was wondering how i can minimize the runtime of the following code
int j = 0;
while (j < n) {
int i = 0;
while (i < m) {
cout << i*j;
i++;
}
j++;
}
There's not much to do, these are just mere loops. However, it is usually more efficient to accumulate the strings and print at the end than printing tiny strings several times.