归档 2018

[LeetCode]Largest Component Size by Common Factor

题目描述:

LeetCode 952. Largest Component Size by Common Factor

Given a non-empty array of unique positive integers A, consider the following graph:

  • There are A.length nodes, labelled A[0] to A[A.length - 1];
  • There is an edge between A[i] and A[j] ...

继续阅读

Java8 Stream 计算数组最大值、最小值

最大值(整数数组):

Arrays.stream(A).max().getAsInt()

int[] A = {6,7,8,2,1,3,4,5};
int maxVal = Arrays.stream(A).max().getAsInt();

最小值(整数数组):

Arrays.stream(A).min().getAsInt()

int[] A = {6,7,8,2,1,3,4,5};
int minVal = Arrays.stream(A).min().getAsInt();

 

每月存档

去年

明年