leetcode

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

commitf67df5412a9878f7a8ee5236dbbefdf464921047
parent9c2ca75178c23ea2e2fbc498fdb8c1e955f01988
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateFri, 1 Dec 2023 19:06:14 +0000

Daily Problem

Diffstat:
AProblems/1662.cpp|++++++++++++
MREADME.md|+

2 files changed, 13 insertions(+), 0 deletions(-)


diff --git a/Problems/1662.cpp b/Problems/1662.cpp

@@ -0,0 +1,12 @@

class Solution {
public:
bool arrayStringsAreEqual(const vector<string> &word1, const vector<string> &word2) const {
int i = 0, j = 0, k = 0, l = 0;
while (i < word1.size() && j < word2.size()) {
if (word1[i][k] != word2[j][l]) return false;
if (++k == word1[i].size()) k = 0, i++;
if (++l == word2[j].size()) l = 0, j++;
}
return i == word1.size() && j == word2.size();
}
};

diff --git a/README.md b/README.md

@@ -704,6 +704,7 @@ for solving problems.

| 1653 | Medium | [Minimum Deletions to Make String Balanced](Problems/1653.cpp) |
| 1657 | Medium | [Determine if Two Strings Are Close](Problems/1657.cpp) |
| 1658 | Medium | [Minimum Operations to Reduce X to Zero](Problems/1658.cpp) |
| 1662 | Easy | [Check If Two String Arrays are Equivalent](Problems/1662.cpp) |
| 1663 | Medium | [Smallest String With A Given Numeric Value](Problems/1663.cpp) |
| 1664 | Medium | [Ways to Make a Fair Array](Problems/1664.cpp) |
| 1669 | Medium | [Merge In Between Linked Lists](Problems/1669.cpp) |