cybersecurity · intermediate · ~15 min · safe pentest lab
Count unique values.
Implement int distinct_ports(const int *ports, int n) returning the number of distinct port numbers in the array.
int distinct_ports(const int *ports, int n) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.