Skip to content
← Back to Community
7.6. Lists: Number of distinct elements
Profile icon
pole55

Given a list of numbers with all elements sorted in ascending order, determine and print the number of distinct elements in it.

Example input: 1 2 2 3 3 3
Example output: 3

Voters
Profile icon
AddisonLeonard
Profile icon
sumitK2
Profile icon
KieraYoung
Profile icon
VeronicaNaegele
Profile icon
HaodongGe
Profile icon
IsaacOV
Profile icon
pole55