Advertisement
Guest User

Untitled

a guest
May 24th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import java.util.stream.IntStream;
  2. class Solution {
  3. public int solution(int[] A) {
  4. // write your code in Java SE 8
  5. int[]sorted=IntStream.of(A).sorted().toArray();
  6. for(int index=2;index<sorted.length;index++){
  7. long ind1=(long)sorted[index];
  8. long ind2=(long)sorted[index-1];
  9. long ind3=(long)sorted[index-2];
  10. if(ind3+ind2>ind1&&ind1+ind2>ind3&&ind3+ind1>ind2){
  11. return 1;
  12. }
  13.  
  14. }
  15. return 0;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement