Ad
Code
Diff
  • function unique_in_order(iterable){
      return iterable.split("").filter((x,i) => x!==iterable.split("")[i+1]);
    }
        
    • def unique_in_order(iterable):
    • iterable = list(iterable)
    • while 1==1:
    • for x in range(len(iterable)):
    • if iterable[x]==iterable[x-1]:
    • del iterable[x]
    • break
    • if x==len(iterable)-1:
    • return iterable
    • function unique_in_order(iterable){
    • return iterable.split("").filter((x,i) => x!==iterable.split("")[i+1]);
    • }

traversed using streams instead of for loops

Code
Diff
  • import java.util.*;
    public class Kumite {
      public static String highAndLow(String numbers) {
       Object maxValue = Arrays.stream(numbers.split(" "))
                       .filter(n -> Arrays.stream(numbers.split(" "))
                       .noneMatch(n2 -> Integer.parseInt(n2)>Integer.parseInt(n))).toArray()[0];
       Object minValue = Arrays.stream(numbers.split(" "))
                       .filter(n -> Arrays.stream(numbers.split(" "))
                       .noneMatch(n2 -> Integer.parseInt(n2)<Integer.parseInt(n))).toArray()[0];
      return maxValue +" "+minValue;
      }
    }
    
    • import java.util.*;
    • public class Kumite {
    • public static String highAndLow(String numbers) {
    • String[] integerStrings = numbers.split(" ");
    • int maxValue = Integer.parseInt(integerStrings[0]);
    • int minValue = Integer.parseInt(integerStrings[0]);
    • for (int i = 1; i < integerStrings.length; i++){
    • int number = Integer.parseInt(integerStrings[i]);
    • if(number > maxValue){
    • maxValue = number;
    • }
    • if(number < minValue){
    • minValue = number;
    • }
    • }
    • return Integer.toString(maxValue) + " " + Integer.toString(minValue);
    • Object maxValue = Arrays.stream(numbers.split(" "))
    • .filter(n -> Arrays.stream(numbers.split(" "))
    • .noneMatch(n2 -> Integer.parseInt(n2)>Integer.parseInt(n))).toArray()[0];
    • Object minValue = Arrays.stream(numbers.split(" "))
    • .filter(n -> Arrays.stream(numbers.split(" "))
    • .noneMatch(n2 -> Integer.parseInt(n2)<Integer.parseInt(n))).toArray()[0];
    • return maxValue +" "+minValue;
    • }
    • }