Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static boolean f(List<String> l, String s) {
- if (l.contains(s) || s.isEmpty()) {
- return true;
- } else {
- boolean result = false;
- for (String elem : l) {
- if (s.startsWith(elem)) {
- result = result || f(l, s.substring(elem.length()));
- if (result) {
- return true;
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment