Answer:
6 rows.
Explanation:
To solve this question, we need to find te Greatest Common Factor which is the largest positive integer that divieds each number equally.
So, in this case we have the numbers 12 and 18, their divisors are


If you compare both sets, you would find that the largest common number is six, that means the Greatest Common Factor between these two numbers is 6.
Therefore, Sam can arrange the photos in 6 rows.