Solution


  • 0
    D

    class Solution {
    public boolean isSubsequence(String s, String t) {
    int p = 0;
    int q = 0;
    while( p <s.length() && q < t.length()){
    if(s.charAt(p) == t.charAt(q)){
    p += 1;
    }
    q += 1;
    }

        return p == s.length();
    }
    

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.