---
# System prepended metadata

title: 0392. Is Subsequence
tags: [Leetcode, Two Pointers, Easy]

---

# 0392. Is Subsequence
###### tags: `Leetcode` `Easy` `Two Pointers`
Link: https://leetcode.com/problems/is-subsequence/
## Code
```java=
class Solution {
    public boolean isSubsequence(String s, String t) {
        int p1 = 0, p2 = 0;
        while(p1<s.length() && p2<t.length()){
            if(s.charAt(p1)==t.charAt(p2)) p1++;
            p2++;
        }
        if(p1 == s.length()) return true;
        else return false;
    }
}
```