-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
35 lines (30 loc) · 861 Bytes
/
Program.cs
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
32
33
34
35
using System;
/*
https://leetcode.com/problems/toeplitz-matrix/
*/
namespace ToeplitzMatrix
{
class Program
{
static void Main(string[] args)
{
var input = new int[3][]{
new int[] { 1,2,3,4 },
new int[] { 5,1,2,3 },
new int[] { 9,5,1,2 }
};
var solution = Solve(input);
Console.WriteLine(solution);
}
static bool Solve(int[][] matrix) {
for (int i = 0; i < matrix.Length - 1; i++) {
for (int j = 0; j < matrix[i].Length - 1; j++) {
if (matrix[i][j] != matrix[i + 1][j + 1]) {
return false;
}
}
}
return true;
}
}
}