752. IP to CIDR

Medium
String
Bit Manipulation

Description

Hints

Hint 1
Convert the ip addresses to and from (long) integers. You want to know what is the most addresses you can put in this block starting from the "start" ip, up to n. It is the smallest between the lowest bit of start and the highest bit of n. Then, repeat this process with a new start and n.

Statistics

Acceptance
53.6%
Submissions
68,368
Accepted
36,630