Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public boolean isSubsequence(String s, String t) {
- char[] arr = s.toCharArray();
- int start = 0;
- for (char c : arr) {
- boolean found = false;
- for (int i = start; i < t.length(); i++) {
- if (c == t.charAt(i)) {
- found = true;
- start = i + 1;
- break;
- }
- }
- if (!found) return false;
- }
- return true;
- }
- }
Add Comment
Please, Sign In to add comment