Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save codeperfectplus/a72681b73fdb76eb07e76328487ff5ed to your computer and use it in GitHub Desktop.

Select an option

Save codeperfectplus/a72681b73fdb76eb07e76328487ff5ed to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
int diagonalDifference(vector<vector<int>> arr) {
int s1 = 0;
int s2 = 0;
int n = arr.size();
for(int i=0;i<n;i++) {
s1 += arr[i][i];
s2 += arr[i][n-i-1];
}
return abs(s1 - s2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment