# 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; } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up