Determine if a word can be constructed from list of subsets The question is explained well by examples in the comments below. Also I request verifying complexity:  O( n * n!), where n is the number of words in the subsets. Review my code for optimizations, best practices etc.

/**
 * Question is better explained by examples:
 * 1. given
 *    i/p subsets  - ["un", "xy", "te", "i", "d"]
 *    and i/p string is : united should result in true.
 *    and i/p string of : union should result in false.
 *  
 * 2. i/p subsets - ["tonyl", "pqr", "pqrbri",] 
 *    and i/p string of : briton should be true.
 *    and i/p string of : japan should result in false.
 *
 * Complexity: O( n * n!) where n is numnber of subset words.
 *
 */
public final class StringFromSubSets {

    private StringFromSubSets() {}

    private static int getFactorial (int length) {
        int factorial = 1;
        for (int i = 1; i &lt;= length; i++) {
            factorial = factorial * i;
        }
        return factorial;
    }


    private static void swapWithNext (List&lt;String&gt; subStrings, int i) {
        assert subStrings != null;
        assert i &gt;= 0 &amp;&amp; i &lt; subStrings.size() - 1; 

        String str = subStrings.get(i);
        subStrings.set(i, subStrings.get(i + 1));
        subStrings.set(i + 1, str);
    }


    private static String join (List&lt;String&gt; list) {
        assert list != null;

        final StringBuffer sb = new StringBuffer();
        for (String str : list) {
            sb.append(str);
        }
        return sb.toString();
    }


    private static Set&lt;String&gt; getPermutations(List&lt;String&gt; subStrings) {
        assert subStrings != null;

        final Set&lt;String&gt; set = new HashSet&lt;String&gt;();
        int factorial = getFactorial(subStrings.size());
        int counter = 0;

        while (counter &lt; factorial) {
            for (int i = 0; i &lt; subStrings.size() - 1; i++) {
                swapWithNext (subStrings, i);   // O(1)
                String joinedString = join (subStrings); // O(n)
                set.add(joinedString);
                counter++;
            }
        }
        return set;
    }


    public static boolean stringGotFromSubSets(List&lt;String&gt; subStrings, String wordToFind) {
        if (subStrings == null) {
            throw new NullPointerException("The substring provided is null.");
        }

        final Set&lt;String&gt; joinedStrings = getPermutations(subStrings);
        for (String joinedString : joinedStrings) {
            if (joinedString.contains(wordToFind)) return true;
        }

        return false;
    }


    public static void main(String[] args) {
        List&lt;String&gt; listOfString = new ArrayList&lt;String&gt;();
        listOfString.add("sachin");
        listOfString.add("tendulkar");
        listOfString.add("rahul");
        listOfString.add("dravid");
        System.out.println("Expected true, Actual " + stringGotFromSubSets(listOfString, "int"));
        System.out.println("Expected true, Actual " + stringGotFromSubSets(listOfString, "idsa"));
        System.out.println("Expected true, Actual " + stringGotFromSubSets(listOfString, "sachindravid"));

        System.out.println("Expected false, Actual " + stringGotFromSubSets(listOfString, "sehwag"));
        System.out.println("Expected false, Actual " + stringGotFromSubSets(listOfString, "ganguly"));
    }

}
Your getPermutations() fails to generate all permutations.  Consider…

public static void main(String[] args) {
    List&lt;String&gt; list = Arrays.asList(args);
    for (String s : getPermutations(list)) {
        System.out.println(s);
    }
}


If you run java StringFromSubSets 0 1 2 3 | sort, the result is:


0123
0132
0312
1023
1203
1230
2130
2301
2310
3012
3021
3201



There should be 4! = 24 permutations, but you have produced only 12.  For example, where is 0321?  In other words,

public static void main(String[] args) {
    // Simpler initialization than the original
    List&lt;String&gt; listOfString = Arrays.asList(new String[] {
        "sachin", "tendulkar", "rahul", "dravid"
    });
    System.out.println("Expected true, Actual " +
        stringGotFromSubSets(listOfString, "drahultendulkars"));
}


… prints Expected true, Actual false.