Skip to content

Instantly share code, notes, and snippets.

@s4553711
Created January 22, 2018 15:00
Show Gist options
  • Save s4553711/e46e36d0a76bcdbadfdda961cbd37ca9 to your computer and use it in GitHub Desktop.
Save s4553711/e46e36d0a76bcdbadfdda961cbd37ca9 to your computer and use it in GitHub Desktop.
class Solution {
public:
bool isToeplitzMatrix(vector<vector<int>>& matrix) {
for(int i = 1; i < matrix.size(); i++) {
for(int j = 1; j < matrix[i].size(); j++) {
if (matrix[i][j] != matrix[i-1][j-1]) return false;
}
}
return true;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment