def myFunction(n): for i in range(n): # O(n) for j in range(i, i * i): # O(i^2 - i) => O(n^2 - n) => O(n^2) if j % i == 0: # O(1) # Check if j is divisible by i for k in range(j): # O(n!) print("*", end="") # Print '*' to the console without newline print() # Example usage myFunction(5)