1239. Maximum Length of a Concatenated String with Unique Characters
Runtime: 6 ms, faster than 21.93% of Java online submissions for Is Subsequence. Memory Usage: 41.8 MB, less than 63.47% of Java online submissions for Is Subsequence.
class Solution {
public boolean isSubsequence(String s, String t) {
if(s.length() == 0)
return true;
int index = 0;
for(int i=0; i<t.length(); i++) {
if(s.charAt(index) == t.charAt(i)) {
index++;
}
if(index == s.length())
return true;
}
return false;
}
}