Skip to content

Commit

Permalink
Merge pull request neetcode-gh#1250 from tharunkanna14/patch-2
Browse files Browse the repository at this point in the history
Create 0392_is_subsequence.java
  • Loading branch information
Ahmad-A0 authored Oct 22, 2022
2 parents e7fbd4b + 52390d3 commit 7f28ff7
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 7f28ff7

Please sign in to comment.