Isolate the Even Batches

Basic

A batch processor only handles even-numbered batch IDs. Filter a list of IDs down to just the even ones, keeping their original order.

Implement `solve(List<Integer> nums)` to return only the even values, in their original order.

Examples

Input[1, 2, 3, 4, 5, 6, 7, 8]
Output[2, 4, 6, 8]
Input[1, 3, 5]
Output[]
Hints
  • Math.mod(n,2)==0 detects even numbers; add() preserves order.
Anonymous Apex

Your code runs in a secure sandbox against multiple hidden test cases. The problem is solved only when every test passes. Each run is isolated and any data changes are rolled back automatically.