leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit 1862ef041e14f0472f065b3da40d77f921c95646
parent 0a244a958445151eee968b310939e93843f31af0
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sun, 12 May 2024 23:07:45 +0200

Daily Problem

Diffstat:
AProblems/2373.cpp | 19+++++++++++++++++++
MREADME.md | 1+
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/Problems/2373.cpp b/Problems/2373.cpp @@ -0,0 +1,19 @@ +class Solution { + public: + vector<vector<int>> largestLocal(const vector<vector<int>> &grid) const { + const int n = size(grid); + vector<vector<int>> res(n - 2, vector(n - 2, 0)); + + for (int i = 0; i < n - 2; i++) { + for (int j = 0; j < n - 2; j++) { + for (int k = i; k <= i + 2; k++) { + for (int l = j; l <= j + 2; l++) { + res[i][j] = max(res[i][j], grid[k][l]); + } + } + } + } + + return res; + } +}; diff --git a/README.md b/README.md @@ -1096,6 +1096,7 @@ for solving problems. | 2368 | Medium | [Reachable Nodes With Restrictions](Problems/2368.cpp) | | 2369 | Medium | [Check if There is a Valid Partition For The Array](Problems/2369.cpp) | | 2370 | Medium | [Longest Ideal Subsequence](Problems/2370.cpp) | +| 2373 | Easy | [Largest Local Values in a Matrix](Problems/2373.cpp) | | 2374 | Medium | [Node With Highest Edge Score](Problems/2374.cpp) | | 2375 | Medium | [Construct Smallest Number From DI String](Problems/2375.cpp) | | 2385 | Medium | [Amount of Time for Binary Tree to Be Infected](Problems/2385.cpp) |