leetcode

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

commit c270c9f8ec441e3173ef5b39276afcb9ba7edf2e
parent 16621cc2814b0348681f8d2f53be709aeb0a14f1
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Wed,  1 Feb 2023 22:31:41 +0100

Daily Problem

Diffstat:
AProblems/1071.cpp | 7+++++++
MREADME.md | 1+
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/Problems/1071.cpp b/Problems/1071.cpp @@ -0,0 +1,7 @@ +class Solution { +public: + string gcdOfStrings(string str1, string str2) { + if(str1 + str2 != str2 + str1) return ""; + return str1.substr(0, gcd(str1.size() ,str2.size())); + } +}; diff --git a/README.md b/README.md @@ -283,6 +283,7 @@ for solving problems. | 1047 | Easy | [Remove All Adjacent Duplicates In String](Problems/1047.cpp) | | 1051 | Easy | [Height Checker](Problems/1051.cpp) | | 1061 | Medium | [Lexicographically Smallest Equivalent String](Problems/1061.cpp) | +| 1071 | Easy | [Greatest Common Divisor of Strings](Problems/1071.cpp) | | 1089 | Easy | [Duplicate Zeros](Problems/1089.cpp) | | 1095 | Easy | [Find Numbers with Even Number of Digits](Problems/1095.cpp) | | 1099 | Easy | [Replace Elements with Greatest Element on Right Side](Problems/1099.cpp) |