public int compute()
    {
        subSequence[0] = seq[0];
        len = 1;

        for (int i = 1; i < seq.length; i++) {
           if (seq[i] < subSequence[len-1]) {
                subSequence[len++] = seq[i];
            } else if (seq[i] > subSequence[0]) {
                subSequence[0] = seq[i];
            } else {
                int index = findPos(subSequence, 0, len-1, seq[i]);
                subSequence[index] = seq[i];
            } 
        }

        return (len);
    }