HTMLify
Day 130
Views: 2 | Author: djdj
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | class Solution { /** * @param String $s * @param String $t * @return Boolean */ function isSubsequence($s, $t) { $lenS = strlen($s); $lenT = strlen($t); $i = 0; $j = 0; while ($i < $lenS && $j < $lenT) { if ($s[$i] === $t[$j]) $i++; $j++; } if ($i === $lenS) return true; else return false; } } |