20ms O(t) Java solution


  • 0
    C
        public boolean isSubsequence(String s, String t) {
            if (s.length() == 0) return true;
            int i = 0;
            for (char c: t.toCharArray()) {
                if (c == s.charAt(i) && ++i == s.length()) return true;
            }
            return false;
        }
    

Log in to reply
 

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