Leetcode算法学习日志:IP到CIDR转换
发布时间
阅读量:
阅读量
Leetcode 751 IP to CIDR
题目原文
Be required to determine, given a starting IP address ip and the total number of IPs that must be included in the coverage, the representation as a list (of minimal length) of CIDR blocks needed.
A CIDR块由一个IP地址后跟一个斜杠以及前缀长度组成。“例如:123.45.67.89/20。”其中,“该前缀长度为' 该前缀长度' 为' 该数值' ,则表示指定范围内共有多少位共同的前导位数。“在示例中,“123.45.67.89/20”中,“表示在该范围内共有多少位共同的前导位。”
Example 1:
**Input:** ip = "255.0.0.7", n = 10
**Output:** ["255.0.0.7/32","255.0.0.8/29","255.0.0.16/32"]
**Explanation:**
The initial ip address, when converted to binary, looks like
全部评论 (0)
还没有任何评论哟~
