1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; public class _String { /** * Print Print all subsequences of a string * * http://www.geeksforgeeks.org/print-subsequences-string/ * */ public static List<String> all_subsequece_in_a_string(String str) { return powerSet(str.toCharArray()).stream() .filter(c -> c.length != 0) .map(String::new) .distinct() .collect(Collectors.toList()); } } |
styled using hilite.me
No comments:
Post a Comment