leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | ebdf49c4de003d3de6feb752c630f2c1c719d1e3 |
parent | 70fe27284059abfe0f4ed261d425a6eb05d2d1fd |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Sun, 23 Jun 2024 11:13:32 +0200 |
1 Random Problem
Diffstat:A | Problems/0672.cpp | | | ++++++++++ |
M | README.md | | | + |
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Problems/0672.cpp b/Problems/0672.cpp
@@ -0,0 +1,10 @@
class Solution {
public:
int flipLights(const int n, const int presses) const {
if (n == 0 || presses == 0) return 1;
if (n == 1) return 2;
if (n == 2) return presses == 1 ? 3 : 4;
if (presses == 1) return 4;
return presses == 2 ? 7 : 8;
}
};
diff --git a/README.md b/README.md
@@ -452,6 +452,7 @@ for solving problems.
| 0667 | Medium | [Beautiful Arrangement II](Problems/0667.cpp) |
| 0669 | Medium | [Trim a Binary Search Tree](Problems/0669.cpp) |
| 0671 | Easy | [Second Minimum Node In a Binary Tree](Problems/0671.cpp) |
| 0672 | Medium | [Bulb Switcher II](Problems/0672.cpp) |
| 0673 | Medium | [Number of Longest Increasing Subsequence](Problems/0673.cpp) |
| 0676 | Medium | [Implement Magic Dictionary](Problems/0676.cpp) |
| 0677 | Medium | [Map Sum Pairs](Problems/0677.cpp) |