def solution(brown, yellow): total = brown + yellow num = [] idx = 3 while (True) : if total % idx == 0 : if idx > total // idx : break num.append([total // idx, idx]) idx += 1 for n in num : temp = (n[0]-2)*2 + n[1]*2 if temp == brown : return [n[0], n[1]] break 그냥 로직만 잘 짜면 금방 해결할 수 있는 문제였다 일단 (brown + yellow) 의 약수를 구해주는데, 1과 2는 가로/세로 길이가 될 수 없기 때문에 애초에 idx 를 3으로 초기화시켜줌. 그리고 가로 길이가 세로 길이보다 더 커야..