Skip to content

Instantly share code, notes, and snippets.

@cosminpopescu14
Created August 22, 2019 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cosminpopescu14/473318af8f71d4e68426e59a07953cf9 to your computer and use it in GitHub Desktop.
Save cosminpopescu14/473318af8f71d4e68426e59a07953cf9 to your computer and use it in GitHub Desktop.
package com.company;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
int array[] = {1,2,1,2,3,3};
System.out.println(isConsecutive());
}
private static Boolean isConsecutive(int array[]) {
return Arrays
.stream(array)
.mapToLong(Long::new)
.distinct()
.sum() == array.length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment