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 |
Tags
- 셰그먼트트리
- command not found
- 1759번
- 백준 1253번
- 트랜잭션 관리
- 데이터베이스 배움터
- 2단계로킹
- oracle
- 의미와 무의미의 경계에서
- C++
- 오손데이터읽기
- UnrealMP
- OS
- objtofbx
- 실습
- hackerank
- 민겸수
- FBX
- Security
- Unreal
- 5639
- Linux
- 1967번
- 1253번
- 백준
- UActor
- 비재귀셰그먼트
- 언리얼 플러그인
- 언리얼 커스텀 플러그인
- SQL
Archives
- Today
- Total
fatalite
Diagonal Difference 본문
/*
* Complete the 'diagonalDifference' function below.
*
* The function is expected to return an INTEGER.
* The function accepts 2D_INTEGER_ARRAY arr as parameter.
*/
int diagonalDifference(vector<vector<int>> arr) {
int LeftToRight = 0;
int RightToLeft = 0;
for(int i = 0; i < arr.size(); i++){
LeftToRight += arr[i][i];
//cout << arr[i][i] << " ";
}
cout << endl;
for(int k = arr.size() - 1 ; k >= 0 ; k-- ){
RightToLeft += arr[arr.size()-1-k][k];
//cout << arr[arr.size()-1-k][k] << " ";
}
return abs(LeftToRight - RightToLeft);
}
'코딩 인터뷰 > C++' 카테고리의 다른 글
Subarray Division 2 (0) | 2023.02.03 |
---|---|
Permuting Two Arrays (0) | 2023.01.26 |
Mars Exploration (0) | 2023.01.18 |
Counting Valleys (0) | 2023.01.17 |
Flipping Bits (0) | 2023.01.12 |