Skip to content

Commit

Permalink
Create 0392_is_subsequence.java
Browse files Browse the repository at this point in the history
  • Loading branch information
tharunkanna14 authored Oct 22, 2022
1 parent 840e429 commit b7562ca
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions java/0392_is_subsequence.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution {
public boolean isSubsequence(String s, String t) {
int i = 0, j = 0;
while (i < s.length() && j < t.length()) {
if (s.charAt(i) == t.charAt(j)) {
i += 1;
}
j += 1;
}
if (i == s.length()) {
return true;
} else {
return false;
}
}
}

0 comments on commit b7562ca

Please sign in to comment.