Count Distinct Elements Problem

Count Distinct Elements Problem — ExecCode School DSA Practice

Solve the Count Distinct Elements problem on ExecCode. Free online school DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

You are given a whole number for the problem Count Distinct Elements. Your task is to you will receive a list of whole numbers. Count how many different numbers are in the list. If a number appears more than once, only count it one time. Print this total count of different numbers.

Examples

Input 5 1 2 3 4 5; Output 5. Input 5 1 1 1 1 1; Output 1

Constraints

1 <= N <= 1000 -10^9 <= Array[i] <= 10^9

Practice Count Distinct Elements free on ExecCode. Browse DSA problems, topic map, and placement guides.