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

Problem

11.5 Stream pipelines — capstone: one chain each

Read a count and that many numbers. Using streams, print three lines:

  • the distinct values in increasing order, as a list
  • how many values are even
  • every value squared, as a list in the original order

For 6 then 5 3 5 9 1 3:

[1, 3, 5, 9]
0
[25, 9, 25, 81, 1, 9]

Each line is a single chain: distinct/sorted/collect, filter/count, map/collect.

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.

Working…