hello guys i was given homework problem where it asks me to find all distinct substring of a string. I have implemented a method which will tell you all the substrings of s
public ArrayList getAllUniqueSubset(String str) { ArrayList set = new ArrayList(); for (int i = 0; i < str.length(); i++) { for (int j = 0; j < str.length() - i; j++) { String elem = str.substring(j, j + (i+1)); if (!set.contains(elem)) { set.add(elem); } } } return set; }