refactor: refactor project structure
This commit is contained in:
28
legacy/3195 minimumArea/C#/Program.cs
Executable file
28
legacy/3195 minimumArea/C#/Program.cs
Executable file
@@ -0,0 +1,28 @@
|
||||
public class Solution {
|
||||
public int MinimumArea(int[][] grid)
|
||||
{
|
||||
var x = grid[0].Length;
|
||||
var y = grid.Length;
|
||||
|
||||
int min_x = x;
|
||||
int max_x = 0;
|
||||
int min_y = y;
|
||||
int max_y = 0;
|
||||
|
||||
for (var i = 0; i < x; i++)
|
||||
{
|
||||
for (var j = 0; j < y; j++)
|
||||
{
|
||||
if (grid[j][i])
|
||||
{
|
||||
min_x = Math.Min(min_x, i);
|
||||
max_x = Math.Max(max_x, i);
|
||||
min_y = Math.Min(min_y, j);
|
||||
max_y = Math.Max(max_y, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (max_x - min_x + 1) * (max_y - min_y + 1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user