Skip to content

Commit 5fc6310

Browse files
fix build
1 parent cb0df72 commit 5fc6310

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/main/java/com/fishercoder/solutions/_809.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class _809 {
44
public static class Solution1 {
5-
public int expressiveWords (String S, String[] words ) {
5+
public int expressiveWords(String S, String[] words) {
66
int ans = 0;
77
for (String w : words) {
88
if (check(S, w)) {
@@ -11,7 +11,8 @@ public int expressiveWords (String S, String[] words ) {
1111
}
1212
return ans;
1313
}
14-
private boolean check (String S, String w) {
14+
15+
private boolean check(String S, String w) {
1516
int i = 0;
1617
int j = 0;
1718
/* Logic is to check whether character at same index of S and w are same
@@ -24,37 +25,33 @@ private boolean check (String S, String w) {
2425
while (i < S.length() && j < w.length()) {
2526
char ch1 = S.charAt(i);
2627
char ch2 = w.charAt(j);
27-
28+
2829
int len1 = getLen(S, i);
2930
int len2 = getLen(w, j);
3031
if (ch1 == ch2) {
3132
if (len1 == len2) {
3233
i = i + len1;
3334
j = j + len2;
34-
}
35-
else if (len1 >= 3 && len2 < len1) {
35+
} else if (len1 >= 3 && len2 < len1) {
3636
i = i + len1;
3737
j = j + len2;
38-
}
39-
else {
38+
} else {
4039
return false;
4140
}
42-
}
43-
else {
41+
} else {
4442
return false;
4543
}
4644
}
4745
return i == S.length() && j == w.length();
4846
}
4947

50-
private int getLen (String value, int i) {
48+
private int getLen(String value, int i) {
5149
i = i + 1;
5250
int count = 1;
53-
for(int j = i; j<value.length(); j++) {
54-
if(value.charAt(j) == value.charAt(i-1)) {
51+
for (int j = i; j < value.length(); j++) {
52+
if (value.charAt(j) == value.charAt(i - 1)) {
5553
count++;
56-
}
57-
else {
54+
} else {
5855
break;
5956
}
6057
}

src/test/java/com/fishercoder/_809Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static void setup() {
1818

1919
@Test
2020
public void test1() {
21-
words = new String[] {"hello", "hi", "helo"};
21+
words = new String[]{"hello", "hi", "helo"};
2222
S = "heeellooo";
2323
assertEquals(1, solution1.expressiveWords(S, words));
2424
}

0 commit comments

Comments
 (0)