Skip to content

Commit

Permalink
Create Append Characters to String to Make Subsequence.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Lokesh598 authored Jun 3, 2024
1 parent 6f7c22d commit ff6c771
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions String/Append Characters to String to Make Subsequence.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public int appendCharacters(String s, String t) {
int m = s.length();
int n = t.length();
int f = 0, sec = 0;
while (f < m && sec < n) {
if (s.charAt(f) == t.charAt(sec)) {
sec++;
}
f++;
}
return n - sec;
}
}

0 comments on commit ff6c771

Please sign in to comment.