Skip to main content

Practice ยท 3 of 4

Write the discriminating test

CHALLENGE
Difficulty: beginner+25 XP

Implement static int FirstDistinct(int[] nums) โ€” the first element that differs from all previous ones (nums[0] never qualifies); -1 when none. Then the graded part: your own test group must include a case distinguishing "first distinct" from "any distinct" and a case for the all-equal array.

Back to lesson: Practice: Debugging workout