Is Subsequence - 4 lines AC Java Solution

  • 0
        public boolean isSubsequence(String s, String t) {
            int i, j, m=s.length(), n=t.length();
            for(i=0, j=0; i<m && j<n;j++)
                if( s.charAt(i) == t.charAt(j) ) i++;
            return i==m;

Log in to reply

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