Jam's story
[프로그래머스] 종이자르기 java 본문
class Solution {
public int solution(int M, int N) {
int answer = 0;
if (M<0 || N<0) return 0;
answer+=M-1;
answer+=M*(N-1);
return answer;
}
}
다른사람풀이
class Solution {
public int solution(int M, int N) {
return M - 1 + (N - 1 ) * M;
}
}
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] 잘라서 배열로 저장하기 java (0) | 2022.12.13 |
---|---|
[프로그래머스]문자열 밀기 java (0) | 2022.12.12 |
[프로그래머스] 다음에 올 숫자 - java (0) | 2022.12.09 |
[프로그래머스] n의 배수 고르기 (0) | 2022.11.20 |
[프로그래머스] 행렬의 덧셈 (0) | 2022.08.13 |
Comments