Ad
Code
Diff
  • class Kata {
      static int findShort(String st) {
        return java.util.Arrays.stream(st.split("\\s+")).mapToInt(s -> s.length()).min().getAsInt();
      }
    }
    • class Kata {
    • static String r;
    • static int findShort(String st) {
    • java.util.Arrays.stream((r = st).split("\\s+")).filter(s -> s.length() < r.length() ? (r = s).length() > 0 : false).forEach(s -> {});
    • return r.length();
    • return java.util.Arrays.stream(st.split("\\s+")).mapToInt(s -> s.length()).min().getAsInt();
    • }
    • }
Code
Diff
  • class Kata {
      static String r;
      static int findShort(String st) {
        java.util.Arrays.stream((r = st).split("\\s+")).filter(s -> s.length() < r.length() ? (r = s).length() > 0 : false).forEach(s -> {});
        return r.length();
      }
    }
    • import java.util.Arrays;
    • public class Kata {
    • public static int findShort(String s) {
    • String[] split = s.split(" ");
    • Arrays.sort(split,(String o1,String o2) -> o1.length() - o2.length());
    • return split[0].length();
    • }
    • class Kata {
    • static String r;
    • static int findShort(String st) {
    • java.util.Arrays.stream((r = st).split("\\s+")).filter(s -> s.length() < r.length() ? (r = s).length() > 0 : false).forEach(s -> {});
    • return r.length();
    • }
    • }
Code
Diff
  • class Kata {
    
      static String r;
      static int findShort(String st) {
        java.util.Arrays.stream((r = st).split("\\s+")).filter(s -> s.length() < r.length() ? (r = s).length() > 0 : false).forEach(s -> {});
        return r.length();
      }
    }
    
    • class Kata {
    • static int findShort(String s) {
    • int min = -1;
    • for (int i = 0, l = 0; i < s.length(); i++, l++) {
    • if (s.charAt(i) == ' ') {
    • if (l > 0 && (min < 0 || l < min)) {
    • if ((min = l) == 1) {
    • break;
    • }
    • }
    • l = -1;
    • }
    • }
    • return min;
    • static String r;
    • static int findShort(String st) {
    • java.util.Arrays.stream((r = st).split("\\s+")).filter(s -> s.length() < r.length() ? (r = s).length() > 0 : false).forEach(s -> {});
    • return r.length();
    • }
    • }