for i = 1 to n
for j = 1 to i - 1
Is the runtime of this O(n^2)? Is there a good way to visualize things when approaching these types of problems to find the right answer?
Each for loop is O(n), two for loops O(n)*O(n) = O(n^2)
Check this link out. The author explains good ways to approach figuring out runtimes.