My Solution


  • 0
    T

    public class Solution {

    public bool IsSubsequence(string s, string t) {
        int sLen = s.Length;
        
        int tLen = t.Length;
        int i = 0;
        int j = 0;
        while(i<sLen && j < tLen){
            if(s[i] == t[j]){
                i++;
            }
            
            j++;
        }
        
        return i==sLen;
    }
    

    }


Log in to reply
 

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