leetcode

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

commit e042766995d0e1e9a550d9f0993af59d72b34be6
parent bf835215db3c2b630e325b4957b34761deab7d9a
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Wed, 27 Dec 2023 19:29:18 +0000

1 Random Problem

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

diff --git a/Problems/2914.cpp b/Problems/2914.cpp @@ -0,0 +1,10 @@ +class Solution { + public: + int minChanges(const string &s) const { + int res = 0; + for (int i = 1; i < s.size(); i += 2) { + res += s[i] != s[i - 1]; + } + return res; + } +}; diff --git a/README.md b/README.md @@ -1037,4 +1037,5 @@ for solving problems. | 2856 | Medium | [Minimum Array Length After Pair Removals](Problems/2856.cpp) | | 2895 | Medium | [Minimum Processing Time](Problems/2895.cpp) | | 2900 | Medium | [Longest Unequal Adjacent Groups Subsequence I](Problems/2900.cpp) | +| 2914 | Medium | [Minimum Number of Changes to Make Binary String Beautiful](Problems/2914.cpp) | | 2947 | Medium | [Count Beautiful Substrings I](Problems/2947.cpp) |