leetcode

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

commit b78250cf6cef894a878758b2ebd86f4bc137b56a
parent 416930e527bcccfc8725f9e44172fdb11227f64d
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Sun,  3 Dec 2023 20:06:04 +0000

Daily Problem

Diffstat:
AProblems/1266.cpp | 10++++++++++
MREADME.md | 1+
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/Problems/1266.cpp b/Problems/1266.cpp @@ -0,0 +1,10 @@ +class Solution { + public: + int minTimeToVisitAllPoints(const vector<vector<int>> &points) const { + int res = 0; + for (int i = 1; i < points.size(); i++) { + res += max(abs(points[i][0] - points[i - 1][0]), abs(points[i][1] - points[i - 1][1])); + } + return res; + } +}; diff --git a/README.md b/README.md @@ -577,6 +577,7 @@ for solving problems. | 1249 | Medium | [Minimum Remove to Make Valid Parentheses](Problems/1249.cpp) | | 1254 | Medium | [Number of Closed Islands](Problems/1254.cpp) | | 1261 | Medium | [Find Elements in a Contaminated Binary Tree](Problems/1261.cpp) | +| 1266 | Easy | [Minimum Time Visiting All Points](Problems/1266.cpp) | | 1267 | Medium | [Count Servers that Communicate](Problems/1267.cpp) | | 1268 | Medium | [Search Suggestions System](Problems/1268.cpp) | | 1269 | Hard | [Number of Ways to Stay in the Same Place After Some Steps](Problems/1269.cpp) |