We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4ec7eab + 79c4681 commit 892c158Copy full SHA for 892c158
Coding/arrayStringsAreEqual.java
@@ -0,0 +1,27 @@
1
+class Solution {
2
+ public boolean arrayStringsAreEqual(String[] w1, String[] w2) {
3
+ int wInd1 = 0;
4
+ int wInd2 = 0;
5
+ int ind1 = 0;
6
+ int ind2 = 0;
7
+ while (wInd1 < w1.length && wInd2 < w2.length) {
8
+ if (ind1 == w1[wInd1].length() || ind2 == w2[wInd2].length()) {
9
+ if (ind1 == w1[wInd1].length()) {
10
+ wInd1++;
11
+ ind1 = 0;
12
+ }
13
+ if (ind2 == w2[wInd2].length()) {
14
+ wInd2++;
15
+ ind2 = 0;
16
17
+ } else {
18
+ if (w1[wInd1].charAt(ind1) != w2[wInd2].charAt(ind2)) {
19
+ return false;
20
21
+ ind1++;
22
+ ind2++;
23
24
25
+ return wInd1 == w1.length && wInd2 == w2.length;
26
27
+}
0 commit comments