Task 7 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

Problem

11.4 Lambdas and streams — capstone: filter and sum

Read a count and then that many whole numbers into a list. Using streams, print three lines:

  • how many numbers are greater than 0
  • the sum of the even numbers
  • the sum of the squares of all numbers

For 5 then 3 -1 4 -2 5:

3
2
55

Each line is one pipeline: filter narrows, mapToInt transforms, count and sum finish the job.

time 1000 ms memory 256 Mb
Solution
Attempts: 0 A hint guides you to the fix — it never writes the code for you.
✦
Ready to check

Press «Submit» to run your code against the task's test cases — that is what sets your score. «AI review» is an optional second opinion: it reads your code — logic and style, not just the output — and suggests the next step without handing over the answer. It never changes your score.

Next module →
Working…