Counting the gems among the rocks
I find your variable naming maddening. For example, list is just about the least informative name possible for a list, and str and st are just about the least informative names possible for strings.

The input validation is a bit awkwardly expressed.  Also, if list is null, then it will still crash with a NullPointerException.

The comment is a bit misleading.

The many places where you reset cnt make your code hard to follow.  Without changing your general strategy too much, here's how you could write it better:

public int getGems(List&lt;String&gt; rocks) {
    if (rocks == null || rocks.isEmpty()) {
        throw new IllegalArgumentException("No Input");
    }

    int gemsCount = 0;
    int n = rocks.size();

    // Use list(0) as a source of candidate gems
    char[] candidateGems = rocks.get(0).toCharArray();
    for (char c : candidateGems) {
        int appearances = 0;
        for (String rock : rocks) {
            if (rock.indexOf(c) &gt;= 0) {
                appearances++;
            } else {
                break;
            }
        }
        if (appearances == n) {
            gemsCount++;
        }
    }
    return gemsCount;
}