Skip to content

Instantly share code, notes, and snippets.

@vigneshwaranr
Created May 29, 2020 07:24
Show Gist options
  • Save vigneshwaranr/a455eeb9277cb82c1dd1ed8eca960da0 to your computer and use it in GitHub Desktop.
Save vigneshwaranr/a455eeb9277cb82c1dd1ed8eca960da0 to your computer and use it in GitHub Desktop.
9e8a12f2112b / sumOfSquaresOfEvenElements
public int sumOfSquaresOfEvenElements(List<Integer> list) {
if (list == null) {
return 0;
}
int acc = 0;
for (int elem: list) {
if (elem % 2 == 0) {
acc += (elem * elem);
}
}
return acc;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment