Skip to content

Commit 007247d

Browse files
committed
Create README - LeetHub
1 parent 2efb697 commit 007247d

File tree

1 file changed

+37
-0
lines changed
  • 2373-largest-local-values-in-a-matrix

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<h2><a href="https://leetcode.com/problems/largest-local-values-in-a-matrix">2373. Largest Local Values in a Matrix</a></h2><h3>Easy</h3><hr><p>You are given an <code>n x n</code> integer matrix <code>grid</code>.</p>
2+
3+
<p>Generate an integer matrix <code>maxLocal</code> of size <code>(n - 2) x (n - 2)</code> such that:</p>
4+
5+
<ul>
6+
<li><code>maxLocal[i][j]</code> is equal to the <strong>largest</strong> value of the <code>3 x 3</code> matrix in <code>grid</code> centered around row <code>i + 1</code> and column <code>j + 1</code>.</li>
7+
</ul>
8+
9+
<p>In other words, we want to find the largest value in every contiguous <code>3 x 3</code> matrix in <code>grid</code>.</p>
10+
11+
<p>Return <em>the generated matrix</em>.</p>
12+
13+
<p>&nbsp;</p>
14+
<p><strong class="example">Example 1:</strong></p>
15+
<img alt="" src="https://assets.leetcode.com/uploads/2022/06/21/ex1.png" style="width: 371px; height: 210px;" />
16+
<pre>
17+
<strong>Input:</strong> grid = [[9,9,8,1],[5,6,2,6],[8,2,6,4],[6,2,2,2]]
18+
<strong>Output:</strong> [[9,9],[8,6]]
19+
<strong>Explanation:</strong> The diagram above shows the original matrix and the generated matrix.
20+
Notice that each value in the generated matrix corresponds to the largest value of a contiguous 3 x 3 matrix in grid.</pre>
21+
22+
<p><strong class="example">Example 2:</strong></p>
23+
<img alt="" src="https://assets.leetcode.com/uploads/2022/07/02/ex2new2.png" style="width: 436px; height: 240px;" />
24+
<pre>
25+
<strong>Input:</strong> grid = [[1,1,1,1,1],[1,1,1,1,1],[1,1,2,1,1],[1,1,1,1,1],[1,1,1,1,1]]
26+
<strong>Output:</strong> [[2,2,2],[2,2,2],[2,2,2]]
27+
<strong>Explanation:</strong> Notice that the 2 is contained within every contiguous 3 x 3 matrix in grid.
28+
</pre>
29+
30+
<p>&nbsp;</p>
31+
<p><strong>Constraints:</strong></p>
32+
33+
<ul>
34+
<li><code>n == grid.length == grid[i].length</code></li>
35+
<li><code>3 &lt;= n &lt;= 100</code></li>
36+
<li><code>1 &lt;= grid[i][j] &lt;= 100</code></li>
37+
</ul>

0 commit comments

Comments
 (0)