static bool containsAtLeastNSpaces(S s, int n) { if (n <= 0) true; int l = l(s); for i to l: if (isSpace(s.charAt(i)) && --n == 0) true; false; }