Skip to content

Commit ff6c771

Browse files
authored
Create Append Characters to String to Make Subsequence.java
1 parent 6f7c22d commit ff6c771

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class Solution {
2+
public int appendCharacters(String s, String t) {
3+
int m = s.length();
4+
int n = t.length();
5+
int f = 0, sec = 0;
6+
while (f < m && sec < n) {
7+
if (s.charAt(f) == t.charAt(sec)) {
8+
sec++;
9+
}
10+
f++;
11+
}
12+
return n - sec;
13+
}
14+
}

0 commit comments

Comments
 (0)