Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

Unique IP Addresses

Given a list of IP addresses in decimal format (a string), find the number of unique IP addresses. An IP address is defined as a string of four parts, each of which is a number between 0 and 255, separated by dots. You need to write a program that reads the input and prints the number of unique IP addresses. Input format: - First line contains an integer N (1 <= N <= 10^6), the number of IP addresses. - Next N lines each contain an IP address in decimal format. Output format: - Print a single integer representing the number of unique IP addresses. Example: Input: 5 192.168.1.1 192.168.1.1 172.16.254.1 192.168.1.2 172.16.254.1 Output: 3

Key concepts

bit_manipulationsets

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.