Big O time complexity of nested for loops [duplicate]

Solution 1:

What does M and N refers to? My assumption is that it refers to "rows" and "columns" respectively. If it is so, then the equation is O(MN) because you loop through M number of N times.

O(N^2) will be correct IF rows and columns are equal.