Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- Stack
- Number Theory
- string
- sorting
- Method
- hash table
- two pointers
- SQL
- dynamic programming
- 파이썬
- simulation
- Matrix
- java
- 자바
- 구현
- Data Structure
- array
- 코딩테스트
- 코테
- Class
- Binary Tree
- Binary Search
- greedy
- Math
- geometry
- bit manipulation
- Tree
- implement
- Counting
- database
Archives
- Today
- Total
코린이의 소소한 공부노트
[프로그래머스/Lv.1] 행렬의 덧셈 본문
1. Input
1) int 행렬 arr1
2) int 행렬 arr2
2. Output
1) arr1과 arr2의 덧셈 결과
3. Constraint
1) 두 행렬의 행과 열의 길이는 500을 넘지 않는다.
2) 두 행렬의 크기는 같다.
4. Example
Input: arr1={{1,2},{2,3}}, arr2={{3,4},{5,6}} -> Output: {{4,6}.{7,9}}
설명:
{ {1+3, 2+4}, = { {4, 6},
{2+5, 3+6}} {7, 9}}
5. Code
1) 첫 코드(2022/??)
int row = arr1.length;
int col = arr1[0].length;
int[][] answer = new int[row][col];
for(int i=0 ; i<row ; i++){
for(int j=0 ; j<col ; j++)
answer[i][j] = arr1[i][j] + arr2[i][j];
}
return answer;
'코딩테스트 풀이 > JAVA' 카테고리의 다른 글
[프로그래머스/Lv.1] 하샤드 수 (0) | 2022.11.23 |
---|---|
[프로그래머스/Lv.1] 핸드폰 번호 가리기 (0) | 2022.11.23 |
[프로그래머스/Lv.1] x만큼 간격이 있는 n개의 숫자 (0) | 2022.11.22 |
[프로그래머스/Lv.1] 직사각형 별찍기 (0) | 2022.11.22 |
[프로그래머스/Lv.1] 소수 만들기 (0) | 2022.11.22 |