Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5fc6310

Browse files
fix build
1 parentcb0df72 commit5fc6310

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
publicclass_809 {
44
publicstaticclassSolution1 {
5-
publicintexpressiveWords(StringS,String[]words) {
5+
publicintexpressiveWords(StringS,String[]words) {
66
intans =0;
77
for (Stringw :words) {
88
if (check(S,w)) {
@@ -11,7 +11,8 @@ public int expressiveWords (String S, String[] words ) {
1111
}
1212
returnans;
1313
}
14-
privatebooleancheck (StringS,Stringw) {
14+
15+
privatebooleancheck(StringS,Stringw) {
1516
inti =0;
1617
intj =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
charch1 =S.charAt(i);
2627
charch2 =w.charAt(j);
27-
28+
2829
intlen1 =getLen(S,i);
2930
intlen2 =getLen(w,j);
3031
if (ch1 ==ch2) {
3132
if (len1 ==len2) {
3233
i =i +len1;
3334
j =j +len2;
34-
}
35-
elseif (len1 >=3 &&len2 <len1) {
35+
}elseif (len1 >=3 &&len2 <len1) {
3636
i =i +len1;
3737
j =j +len2;
38-
}
39-
else {
38+
}else {
4039
returnfalse;
4140
}
42-
}
43-
else {
41+
}else {
4442
returnfalse;
4543
}
4644
}
4745
returni ==S.length() &&j ==w.length();
4846
}
4947

50-
privateintgetLen(Stringvalue,inti) {
48+
privateintgetLen(Stringvalue,inti) {
5149
i =i +1;
5250
intcount =1;
53-
for(intj =i;j<value.length();j++) {
54-
if(value.charAt(j) ==value.charAt(i-1)) {
51+
for(intj =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
publicvoidtest1() {
21-
words =newString[]{"hello","hi","helo"};
21+
words =newString[]{"hello","hi","helo"};
2222
S ="heeellooo";
2323
assertEquals(1,solution1.expressiveWords(S,words));
2424
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp