3 Line Java Recursive Solution


  • 0
    S

    '''
    public boolean isSubsequence(String s, String t) {
    if (s.length()==1) return t.contains(s);
    int i = t.indexOf(s.charAt(0));
    return i<0?false:isSubsequence(s.substring(1), t.substring(i+1));
    }
    '''


Log in to reply
 

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