Consider using something like
StringBuilder sb = new StringBuilder();
for(int i = 0; i < n; i++){
sb.append('a');
}
Is the efficiency of the code O(N^2) or O(N)?
Consider using something like
StringBuilder sb = new StringBuilder();
for(int i = 0; i < n; i++){
sb.append('a');
}
Is the efficiency of the code O(N^2) or O(N)?
It is O(N), meaning it takes the cost of how big you n variable is.